ifcfg-ethX voodoo for a second IP on the same interface

Ed Greshko Ed.Greshko at greshko.com
Sat Apr 21 05:41:22 UTC 2012


On 04/21/2012 01:30 PM, Tommy Pham wrote:
> You're right about the doc and NetworkManager... I had to set it to no
> and bring down the service to make it work...  But then I'm using F17
> beta so maybe NM is broken???
>
> [root at fedora network-scripts]# ls ifcfg-p14*
> ifcfg-p14p1  ifcfg-p14p1:1
>
> [root at fedora network-scripts]# cat ifcfg-p14*
> UUID="d55f8a84-7d34-48a7-9183-de122db1d244"
> NM_CONTROLLED="no"
> HWADDR=**:**:**:**:**:**
> BOOTPROTO="dhcp"
> DEVICE="p14p1"
> ONBOOT="yes"
>
> #UUID="d55f8a84-7d34-48a7-9183-de122db1d244"
> NM_CONTROLLED="no"
> BOOTPROTO="none"
> DEVICE="p14p1:1"
> ONBOOT="yes"
> USERCTL=yes
> #TYPE=Ethernet
> IPADDR=192.168.0.11
> NETMASK=255.255.255.0
> #PREFIX=24
> #DEFROUTE=yes
> IPV4_FAILURE_FATAL=no
> #IPV6INIT=no
> NAME="System p14p1:1"
> UUID=3b279e0d-a2fe-82a3-d15e-6b6fa922d797
>
> p14p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 192.168.0.241  netmask 255.255.255.0  broadcast 192.168.0.255
>         inet6 fe80::52e5:49ff:fe4e:e55a  prefixlen 64  scopeid 0x20<link>
>         ether **:**:**:**:**:**  txqueuelen 1000  (Ethernet)
>         RX packets 684  bytes 145345 (141.9 KiB)
>         RX errors 0  dropped 0  overruns 0  frame 0
>         TX packets 703  bytes 88987 (86.9 KiB)
>         TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
>         device interrupt 52  base 0x2000
>
> p14p1:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
>         inet 192.168.0.11  netmask 255.255.255.0  broadcast 192.168.0.255
>         ether **:**:**:**:**:**  txqueuelen 1000  (Ethernet)
>         device interrupt 52  base 0x2000

Well, I tested what I did with F17-Beta....

[egreshko at f17-beta network-scripts]$ cat ifcfg-p2p1
UUID="9f5509c3-6982-4f52-8204-aabcd69985c9"
NM_CONTROLLED="yes"
BOOTPROTO=none
DEVICE="p2p1"
ONBOOT=yes
TYPE=Ethernet
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=no
NAME="System p2p1"
HWADDR=08:00:27:36:BF:B0
IPADDR0=192.168.0.225
IPADDR1=192.168.0.226
PREFIX0=24
GATEWAY0=192.168.0.1
DNS1=192.168.0.55

But, of course, ifconfig shows this....

p2p1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.225  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::a00:27ff:fe36:bfb0  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:36:bf:b0  txqueuelen 1000  (Ethernet)
        RX packets 4969  bytes 403735 (394.2 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 692  bytes 81289 (79.3 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

and ip shows this....

p2p1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 08:00:27:36:bf:b0 brd ff:ff:ff:ff:ff:ff
    inet 192.168.0.225/24 brd 192.168.0.255 scope global p2p1
    inet 192.168.0.226/24 brd 192.168.0.255 scope global secondary p2p1
    inet6 fe80::a00:27ff:fe36:bfb0/64 scope link
       valid_lft forever preferred_lft forever

So, 2 ways to achieve the goal of multiple IP addresses on a single NIC.

-- 
Never be afraid to laugh at yourself, after all, you could be missing out on the joke
of the century. -- Dame Edna Everage


More information about the users mailing list