Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

iproute2 and ifupdown

39 views
Skip to first unread message

Martin

unread,
Oct 29, 2009, 3:29:45 AM10/29/09
to
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

unread,
Oct 29, 2009, 3:36:00 AM10/29/09
to
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

klaus zerwes

unread,
Oct 29, 2009, 5:42:13 AM10/29/09
to
Martin wrote:
> 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-*, ...

>
> 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

> # /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'

> 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.

>
> Thanks for your hints,
> Martin

Good luck
Klaus

--
Klaus Zerwes
http://www.zero-sys.net

Martin

unread,
Oct 29, 2009, 8:07:31 AM10/29/09
to
Hi Klaus,

On 29 Okt., 10:42, klaus zerwes <kzer...@web.de> wrote:
> 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.

> 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.

> 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.

0 new messages