Main Page | Report this Page
Linux Forum Index  »  Linux Networking  »  iproute2 and ifupdown...
Page 1 of 1    

iproute2 and ifupdown...

Author Message
Martin...
Posted: Wed Oct 28, 2009 9:29 pm
Guest
Hi,

I'm having trouble using ifupdown scripts on debian mixed up with ip
commands. The file /etc/network/interfaces looks as follows

iface eth0 inet static
address 192.168.100.1
network 192.168.100.0
netmask 255.255.255.0
broadcast 192.168.100.255

up ip addr add 172.17.0.1/16 dev eth0

up ip rule add from 192.168.100.0/16 dev eth0 table intern
up ip rule add from 172.17.0.0/16 dev eth0 table extern

up ip route add 192.168.100.0/24 dev eth0 table intern
up ip route add 192.168.200.0/24 via 192.168.100.253 table intern
up ip route add default via 192.168.100.254 table intern

up ip route add 172.17.0.0/16 dev eth0 table extern
up ip route add 192.168.10.0/24 via 172.17.2.1 table extern
up ip route add default via 172.17.254.254 table intern

pre-down ip route flush table intern
pre-down ip route flush table extern
 
Martin...
Posted: Wed Oct 28, 2009 9:36 pm
Guest
Sorry, I didn't finish my message.

iface eth0 inet static
    address 192.168.100.1
    network 192.168.100.0
    netmask 255.255.255.0
    broadcast 192.168.100.255

    up ip addr add 172.17.0.1/16 dev eth0

    up ip rule add from 192.168.100.0/16 dev eth0 table intern
    up ip rule add from 172.17.0.0/16 dev eth0 table extern

    up ip route add 192.168.100.0/24 dev eth0 table intern
    up ip route add 192.168.200.0/24 via 192.168.100.253 table intern
    up ip route add default via 192.168.100.254 table intern

    up ip route add 172.17.0.0/16 dev eth0 table extern
    up ip route add 192.168.10.0/24 via 172.17.2.1 table extern
    up ip route add default via 172.17.254.254 table intern

    pre-down ip route flush table intern
    pre-down ip route flush table extern

pre-down ip rule del from 192.168.100.0/16 dev eth0
pre-down ip rule del from from 172.17.0.0/16 dev eth0

pre-down ip addr del 172.17.0.1/16 dev eth0

When I run

# /etc/init.d/networking stop
Deconfiguring network interfaces...done.

.... everything looks good so far, but the commands "ip addr show" and
also
"ifconfig" show me, that the interface is still configured.

# /etc/init.d/networking start
Configuring network interfaces...RTNETLINK answers: File exists
Failed to bring up eth0.

Should all the IP stuff be outsourced to it's own init script? Or may
I be able
to use the standard netconfig on debian systems?

Thanks for your hints,
Martin
 
Martin...
Posted: Thu Oct 29, 2009 2:07 am
Guest
Hi Klaus,

On 29 Okt., 10:42, klaus zerwes <kzer... at (no spam) web.de> wrote:
Quote:
append a ' || true' to every line regarding up, down, pre-*, ...
that would do the trick. Now I'll come down to the last row in my

interfaces file.

Quote:
let me guess: you did not bring the interface down before you edited
/etc/network/interfaces
you guessed right. I edited the file to my needs and along with the

"|| true"
assignment after a reboot I may stop and restart the network as I
want.

Quote:
Of course you can write your own init-script, but I would try to do it
the debian way.
Because it now works out well, I use the debian way. I'm just curious,

when
the ifupdown package is updated to the iproute2 tools to have a
homogeneous
network config in Debian.

Thanks for your hints,
Martin
 
klaus zerwes...
Posted: Thu Oct 29, 2009 3:42 am
Guest
Martin wrote:
Quote:
Sorry, I didn't finish my message.

iface eth0 inet static
address 192.168.100.1
network 192.168.100.0
netmask 255.255.255.0
broadcast 192.168.100.255

up ip addr add 172.17.0.1/16 dev eth0
[...]
pre-down ip addr del 172.17.0.1/16 dev eth0

append a ' || true' to every line regarding up, down, pre-*, ...

Quote:

When I run

# /etc/init.d/networking stop
Deconfiguring network interfaces...done.

... everything looks good so far, but the commands "ip addr show" and
also
"ifconfig" show me, that the interface is still configured.

let me guess: you did not bring the interface down before you edited
/etc/network/interfaces

Quote:
# /etc/init.d/networking start
Configuring network interfaces...RTNETLINK answers: File exists
Failed to bring up eth0.

try a 'ifconfic eth0 down' and eventually clean up the routing table by
hand before you run 'ifup eth0'

Quote:
Should all the IP stuff be outsourced to it's own init script? Or may
I be able
to use the standard netconfig on debian systems?

you can use files in /etc/network/if-<$action>.d/ but I prefer setting
everything in interfaces.

Of course you can write your own init-script, but I would try to do it
the debian way.

Quote:

Thanks for your hints,
Martin

Good luck
Klaus

--
Klaus Zerwes
http://www.zero-sys.net
 
 
Page 1 of 1    
All times are GMT - 5 Hours
The time now is Sat Nov 28, 2009 8:53 am