OpenWrt Forum Archive

Topic: IP alias on briged interface.

The content of this topic has been archived on 21 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi all,
I have configured networking:

/etc/config/network
config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.255.255.0'

config 'interface' 'lan'
        option 'ifname' 'eth0'
        option 'type' 'bridge'
        option 'proto' 'static'
        option 'ipaddr' '192.168.10.60'
        option 'netmask' '255.255.255.0'
        option 'gateway' '192.168.10.1'
        option 'dns' '213.215.116.99'

config 'alias'
        option 'interface' 'lan'
        option 'proto' 'static'
        option 'ipaddr' '192.168.99.2'
        option 'netmask' '255.255.255.0'

config 'alias'
        option 'interface' 'lan'
        option 'proto' 'static'
        option 'ipaddr' '192.168.199.2'
        option 'netmask' '255.255.255.0'

config 'interface' 'wan'
        option 'ifname' ' '
        option 'proto' 'none'

After start networking I have created and configgures eth0:1 interface with IP as interfave br-lan:1.
This is ifconfig:

br-lan    Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A                                                                       
          inet addr:192.168.10.60  Bcast:192.168.10.255  Mask:255.255.255.0                                                   
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:407 errors:0 dropped:0 overruns:0 frame:0
          TX packets:226 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:27516 (26.8 KiB)  TX bytes:29572 (28.8 KiB)

br-lan:1  Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A
          inet addr:192.168.99.2  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
br-lan:2  Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A
          inet addr:192.168.199.2  Bcast:192.168.199.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0      Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5228 errors:0 dropped:0 overruns:0 frame:0
          TX packets:3195 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:100
          RX bytes:534844 (522.3 KiB)  TX bytes:522987 (510.7 KiB)

eth0:1    Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A
          inet addr:192.168.99.2  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:56 errors:0 dropped:0 overruns:0 frame:0
          TX packets:56 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4940 (4.8 KiB)  TX bytes:4940 (4.8 KiB)

And route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags  Metric Ref    Use Iface
192.168.199.0   0.0.0.0         255.255.255.0    U       0         0        0 br-lan
192.168.99.0     0.0.0.0         255.255.255.0    U       0         0        0 eth0
192.168.99.0     0.0.0.0         255.255.255.0    U       0         0        0 br-lan
192.168.10.0     0.0.0.0         255.255.255.0    U       0         0        0 br-lan
0.0.0.0              192.168.10.1    0.0.0.0            UG    0         0        0 br-lan

Why is it as?
An after, if this OK,  why is not have br-lan:2 alias eth0:x to?
Where is problem in my config file?
Thank's for help.

Works for me but I use trunk. So no idea if this works as well in 8.09 branch...

Network config (uci export network)

package 'network'

config 'switch' 'eth0'
        option 'vlan0' '1 2 3 4 5*'
        option 'vlan1' '0 5'

config 'interface' 'loopback'
        option 'ifname' 'lo'
        option 'proto' 'static'
        option 'ipaddr' '127.0.0.1'
        option 'netmask' '255.0.0.0'

config 'interface' 'lan'
        option 'type' 'bridge'
        option 'ifname' 'eth0.0'
        option 'proto' 'static'
        option 'netmask' '255.255.255.0'
        option 'dns' '192.168.178.1'
        option 'gateway' '192.168.178.1'
        option 'ipaddr' '192.168.178.10'

config 'interface' 'wan'
        option 'ifname' 'eth0.1'
        option 'proto' 'dhcp'

config 'alias'
        option 'interface' 'lan'
        option 'proto' 'static'
        option 'ipaddr' '192.168.99.2'
        option 'netmask' '255.255.255.0'

config 'alias'
        option 'interface' 'lan'
        option 'proto' 'static'
        option 'ipaddr' '192.168.199.2'
        option 'netmask' '255.255.255.0'

ifconfig

root@OpenWrt:~# ifconfig 
br-lan    Link encap:Ethernet  HWaddr 00:1B:FC:6B:7C:A5  
          inet addr:192.168.178.10  Bcast:192.168.178.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1138 errors:0 dropped:0 overruns:0 frame:0
          TX packets:90 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:67408 (65.8 KiB)  TX bytes:13859 (13.5 KiB)

br-lan:1  Link encap:Ethernet  HWaddr 00:1B:FC:6B:7C:A5  
          inet addr:192.168.99.2  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

br-lan:2  Link encap:Ethernet  HWaddr 00:1B:FC:6B:7C:A5  
          inet addr:192.168.199.2  Bcast:192.168.199.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

eth0      Link encap:Ethernet  HWaddr 00:1B:FC:6B:7C:A5  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5400 errors:0 dropped:0 overruns:0 frame:0
          TX packets:921 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:436504 (426.2 KiB)  TX bytes:144615 (141.2 KiB)
          Interrupt:4 

eth0.0    Link encap:Ethernet  HWaddr 00:1B:FC:6B:7C:A5  
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:5273 errors:0 dropped:0 overruns:0 frame:0
          TX packets:835 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:332148 (324.3 KiB)  TX bytes:105467 (102.9 KiB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:55 errors:0 dropped:0 overruns:0 frame:0
          TX packets:55 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:4392 (4.2 KiB)  TX bytes:4392 (4.2 KiB)
root@OpenWrt:~#

I just added two new anonymous alias sections to the network config and rebooted:

uci add network alias
uci set network.@alias[-1].interface=lan
uci set network.@alias[-1].proto=static
uci set network.@alias[-1].ipaddr=192.168.99.2
uci set network.@alias[-1].netmask=255.255.255.0

uci add network alias
uci set network.@alias[-1].interface=lan
uci set network.@alias[-1].proto=static
uci set network.@alias[-1].ipaddr=192.168.199.2
uci set network.@alias[-1].netmask=255.255.255.0

uci commit network
reboot

(Last edited by Dogge on 11 Sep 2009, 14:06)

Hi,

Your'e  way si working. But our config file is identical with your. I don't know, why is my config not working. I setting it with editor.

Thank's

Rony

Hi,

This not working if I only restart firewal  and networking from opened ssh connection.
Alias

eth0:1    Link encap:Ethernet  HWaddr 00:D0:12:0F:E5:2A
          inet addr:192.168.99.2  Bcast:192.168.99.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1

is still configured and routes over eth0:1 too.

This OK only if I reboot router after /etc/config/network reconfiguring. Why?
THX

The discussion might have continued from here.