diff options
-rw-r--r-- | conf.d/Makefile | 2 | ||||
-rw-r--r-- | conf.d/Makefile.FreeBSD | 2 | ||||
-rw-r--r-- | conf.d/Makefile.NetBSD | 2 | ||||
-rw-r--r-- | conf.d/network.BSD | 4 | ||||
-rw-r--r-- | conf.d/network.Linux | 9 | ||||
-rw-r--r-- | conf.d/network.in | 4 | ||||
-rw-r--r-- | init.d/network.in | 14 |
7 files changed, 15 insertions, 22 deletions
diff --git a/conf.d/Makefile b/conf.d/Makefile index 5f9cf453..b9852719 100644 --- a/conf.d/Makefile +++ b/conf.d/Makefile @@ -13,7 +13,7 @@ SOS?= BSD network: network.in network.${OS} cp $@.in $@ - [ -e $@.${OS} ] && cat $@.${OS} >> $@ || true + [ -e $@.${SOS} ] && cat $@.${SOS} >> $@ || true staticroute: staticroute.${SOS} cp $@.${SOS} $@ diff --git a/conf.d/Makefile.FreeBSD b/conf.d/Makefile.FreeBSD index 94a6e7bd..c43a1d4f 100644 --- a/conf.d/Makefile.FreeBSD +++ b/conf.d/Makefile.FreeBSD @@ -1,3 +1 @@ CONF+= ipfw moused powerd rarpd savecore syscons - -network.${OS}: diff --git a/conf.d/Makefile.NetBSD b/conf.d/Makefile.NetBSD index b0694249..18a52cce 100644 --- a/conf.d/Makefile.NetBSD +++ b/conf.d/Makefile.NetBSD @@ -1,3 +1 @@ CONF+= moused rarpd savecore - -network.${OS}: diff --git a/conf.d/network.BSD b/conf.d/network.BSD new file mode 100644 index 00000000..9f49b81a --- /dev/null +++ b/conf.d/network.BSD @@ -0,0 +1,4 @@ + +# You can assign a default route +#defaultroute="192.168.0.1" +#defaultroute6="2001:a:b:c" diff --git a/conf.d/network.Linux b/conf.d/network.Linux index bda4ac0f..f57ec91a 100644 --- a/conf.d/network.Linux +++ b/conf.d/network.Linux @@ -1,11 +1,16 @@ + +# You can assign a default route +#defaultroute="gw 192.168.0.1" +#defaultroute6="gw 2001:a:b:c" + # ifconfig under Linux is not that powerful and doesn't easily handle # multiple addresses # On the other hand, ip (iproute2) is quite powerful and is also supported #ip_eth0="192.168.0.10/24; 192.168.10.10/24" # You can also use ip to add the default route. -#defaultiproute="192.168.0.1" -#defaultiproute6="2001:a:b:c" +#defaultiproute="via 192.168.0.1" +#defaultiproute6="via 2001:a:b:c" # ip doesn't handle MTU like ifconfig, but we can do it like so #ifup_eth0="ip link set \$int mtu 1500" diff --git a/conf.d/network.in b/conf.d/network.in index 68141a71..c7f948cc 100644 --- a/conf.d/network.in +++ b/conf.d/network.in @@ -9,10 +9,6 @@ # You should note that we don't stop the network at system shutdown by default. # If you really need this, then set shutdown_network=YES -# You can assign a default route -#defaultroute="192.168.0.1" -#defaultroute6="2001:a:b:c" - # Lastly, the interfaces variable pulls in virtual interfaces that cannot # be automatically detected. #interfaces="br0 bond0 vlan0" diff --git a/init.d/network.in b/init.d/network.in index 259fb31c..655fc173 100644 --- a/init.d/network.in +++ b/init.d/network.in @@ -253,16 +253,11 @@ start() if [ -n "$defaultroute" ]; then ebegin "Setting default route $defaultroute" - if [ "$RC_UNAME" = Linux -a \ - "${defaultroute#dev }" = "$defaultroute" ]; then - route add default gw $defaultroute - else - route add default $defaultroute - fi + route add default $defaultroute eend $? elif [ -n "$defaultiproute" ]; then ebegin "Setting default route $defaultiproute" - ip route add default via $defaultiproute + ip route add default $defaultiproute eend $? fi @@ -270,9 +265,6 @@ start() ebegin "Setting default route $defaultroute6" if [ "$RC_UNAME" = Linux ]; then routecmd="route -A inet6 add" - if [ "${defaultroute6#dev }" = "$defaultroute6" ]; then - routecmd="$routecmd gw" - fi else routecmd="route -inet6 add" fi @@ -280,7 +272,7 @@ start() eend $? elif [ -n "$defaultiproute6" ]; then ebegin "Setting default route $defaultiproute6" - ip route add default via $defaultiproute6 + ip -f inet6 route add default $defaultiproute6 eend $? fi |