This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
lsts_glued/packages/filesystem/fs/etc/rc.d/network

75 lines
1.8 KiB
Plaintext
Raw Normal View History

2013-07-13 17:19:22 +01:00
start()
{
if [ -n "$cfg_bridge0_ip" ]; then
for itf in $cfg_bridge0_itfs; do
ifconfig $itf 0.0.0.0
done
brctl addbr bridge0
for itf in $cfg_bridge0_itfs; do
brctl addif bridge0 $itf
done
ifconfig bridge0 $cfg_bridge0_ip netmask $cfg_bridge0_nmask up
ifconfig bridge0 multicast
route add -net 224.0.0.0 netmask 240.0.0.0 dev bridge0
fi
# Public ethernet.
if [ -n "$cfg_eth_ext_ip" ]; then
if [ -n "$cfg_eth_ext_mk" ]; then
ifconfig eth0 "$cfg_eth_ext_ip" netmask "$cfg_eth_ext_mk" up
else
ifconfig eth0 "$cfg_eth_ext_ip" up
fi
ifconfig eth0 multicast
route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0
# Fixed mac address with $cfg_eth_ext_mac based derivated from IP address $cfg_eth_ext_ip
if [ -n "$cfg_eth_ext_mac" ]; then
ifconfig eth0 hw ether $cfg_eth_ext_mac
fi
fi
if [ -n "$cfg_eth_ext_gw" ]; then
route add default gw "$cfg_eth_ext_gw"
fi
if [ -n "$cfg_eth_ext_dns" ]; then
echo "nameserver $cfg_eth_ext_dns" > /etc/resolv.conf
fi
# Private ethernet.
if [ -n "$cfg_eth_prv_ip" ]; then
ifconfig eth0:prv "$cfg_eth_prv_ip" up
fi
# Static ARP table.
if [ -n "$cfg_arp_table" ]; then
for e in $cfg_arp_table; do
ip="$(echo $e | cut -f1 -d'|')"
mac="$(echo $e | cut -f2 -d'|')"
arp -s "$ip" "$mac"
done
fi
2013-07-13 17:19:22 +01:00
}
stop()
{
# Public ethernet.
if [ -n "$cfg_eth_ext_gw" ]; then
route del default
fi
if [ -n "$cfg_eth_ext_ip" ]; then
route del -net 224.0.0.0 netmask 240.0.0.0 dev eth0
ifconfig eth0 down
fi
# Private ethernet.
if [ -n "$cfg_eth_prv_ip" ]; then
ifconfig eth0:prv down
fi
}