2nd IP address on an interface
Ed Greshko
ed.greshko at greshko.com
Thu Aug 28 23:20:18 UTC 2014
On 08/29/14 06:11, Robert Moskowitz wrote:
>
> On 08/28/2014 04:24 PM, Tom Horsley wrote:
>> On Thu, 28 Aug 2014 16:16:55 -0400
>> Robert Moskowitz wrote:
>>
>>> So what is missing? Do I need a 70-persistent-net.rules for eth0:0 ??
>> These days, I'm pretty sure you are supposed to include
>> IPADDR2=, NETMASK2=, etc. in the one ifcfg-eth0 file
>> rather than creating a eth0:0 file (at least that worked
>> for me on centos 6.5 this week when setting up IP aliases).
> I added the IPADDR2 and NETMASK2 and it did not add the second address. Even after a reboot.
>
You may be getting confused by using "ifconfig".....
[egreshko at f20f network-scripts]$ cat ifcfg-p2p1
TYPE="Ethernet"
BOOTPROTO=none
DEFROUTE="yes"
IPV4_FAILURE_FATAL=yes
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
NAME="p2p1"
UUID="5ce325cb-5048-48d7-bdc0-457f278fe1f1"
ONBOOT="yes"
DNS1=192.168.1.18
DOMAIN=greshko.com
HWADDR=08:00:27:B7:04:4A
IPADDR0=192.168.1.227
PREFIX0=24
GATEWAY0=192.168.1.1
IPADDR1=192.168.1.19
PREFIX1=24
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
[egreshko at f20f network-scripts]$ ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.227 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 2001:470:d:6bd:a00:27ff:feb7:44a prefixlen 64 scopeid 0x0<global>
inet6 fe80::a00:27ff:feb7:44a prefixlen 64 scopeid 0x20<link>
ether 08:00:27:b7:04:4a txqueuelen 1000 (Ethernet)
RX packets 478 bytes 57719 (56.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 383 bytes 54641 (53.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
*BUT*
[egreshko at f20f network-scripts]$ ip addr
2: enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
link/ether 08:00:27:b7:04:4a brd ff:ff:ff:ff:ff:ff
inet 192.168.1.227/24 brd 192.168.1.255 scope global enp0s3
valid_lft forever preferred_lft forever
inet 192.168.1.19/24 brd 192.168.1.255 scope global secondary enp0s3
valid_lft forever preferred_lft forever
inet6 2001:470:d:6bd:a00:27ff:feb7:44a/64 scope global noprefixroute dynamic
valid_lft 7200sec preferred_lft 600sec
inet6 fe80::a00:27ff:feb7:44a/64 scope link
valid_lft forever preferred_lft forever
And from a second system....
[egreshko at meimei ~]$ ping 192.168.1.19
PING 192.168.1.19 (192.168.1.19) 56(84) bytes of data.
64 bytes from 192.168.1.19: icmp_seq=1 ttl=64 time=0.337 ms
64 bytes from 192.168.1.19: icmp_seq=2 ttl=64 time=0.290 ms
64 bytes from 192.168.1.19: icmp_seq=3 ttl=64 time=0.269 ms
--
If you can't laugh at yourself, others will gladly oblige.
More information about the users
mailing list