On Tue, Feb 24, 2015 at 1:43 AM, Mick <michaelkintz...@gmail.com> wrote:
> On Monday 23 Feb 2015 08:39:42 Walter Dnes wrote:
>>
>> Looks like it's time to play around with the "ip" command and try to
>> duplicate my current setup.  Does anyone have a multi-route setup
>> similar to mine configured with iproute2?  The net.example file says
>>
>> # If you need more than one address, you can use something like this
>> # NOTE: ifconfig creates an aliased device for each extra IPv4 address
>> #       (eth0:1, eth0:2, etc)
>> #       iproute2 does not do this as there is no need to
>> # WARNING: You cannot mix multiple addresses on a line with other
>> parameters! #config_eth0="192.168.0.2/24 192.168.0.3/24 192.168.0.4/24"
>> # However, that only works with CIDR addresses, so you can't use
>> # netmask.
>>
>>   What exactly do they mean by...
>> "iproute2 does not do this as there is no need to"
>
> There is no need to create virtual interfaces like eth0:1 to be able to have
> secondary IP addresses.  The ip command adds them to the same eth0 interface.

Labels (iproute2 aliases) aren't required but can be useful:

# ip a sh dev wlan0
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
    link/ether e8:2a:ea:0f:68:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.240/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever

# ip a add 192.168.1.250/24 brd + label wlan0:0 dev wlan0

# ip a sh dev wlan0
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
    link/ether e8:2a:ea:0f:68:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.240/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever
    inet 192.168.1.250/24 brd 192.168.1.255 scope global secondary wlan0:0
       valid_lft forever preferred_lft forever

# ip a sh label wlan0:0
    inet 192.168.1.250/24 brd 192.168.1.255 scope global secondary wlan0:0
       valid_lft forever preferred_lft forever

# ip a fl label wlan0:0

# ip a sh dev wlan0
2: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP
group default qlen 1000
    link/ether e8:2a:ea:0f:68:ec brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.240/24 brd 192.168.1.255 scope global wlan0
       valid_lft forever preferred_lft forever

Reply via email to