1

I added some virtual IPs to my eth0 interface in CentOS 6.5,

ip addr add 192.168.100.2 dev eth0

I then simply added a VLAN on eth0.

vconfig eth0 10

The VLAN was created but it removes any of my added IPs on eth0 (eg. 192.168.100.2).

I didn't face this issue in CentOS 5.X. The eth0 retains IPs.

Michael Hampton
  • 247,473
Ujjwal
  • 11
  • I've removed "SOLVED" from the title of this question for two reasons: First, that is not how we indicate a question is resolved here, and second, this question obviously does not have a workable answer yet. – Michael Hampton Jul 14 '14 at 11:27

2 Answers2

1

use ip notation for the vlan too - see the archlinux wiki https://wiki.archlinux.org/index.php/VLAN

ip link add link eth0 name eth0.10 type vlan id 10
Dani_l
  • 508
  • Thanks, with Google search I came across the same link. Tried but it has the same problem. All other IPs (except the physical IP) disappear. – Ujjwal Jul 11 '14 at 07:21
  • order is important - first create the link, then add new addr to the new link: ip addr add 192.168.100.2 dev eth0.10 – Dani_l Jul 11 '14 at 07:35
  • The problem I'm facing is with IPs on eth0 which I want to retain. IPs for eth0.10 could be added later without a problem. The IPs however are retained on CentOS 5.4. – Ujjwal Jul 11 '14 at 07:43
  • can you post content of /etc/udev/rules.d/70-persistent-net.rules – Dani_l Jul 11 '14 at 07:54
  • This file was automatically generated by the /lib/udev/write_net_rules

    program, run by the persistent-net-generator.rules rules file.

    You can modify it, as long as you keep each rule on a single

    line, and change only the value of the NAME= key.

    PCI device 0x8086:0x1026 (e1000)

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:0e:0c:aa:9b:aa", ATTR{type}=="1", KERNEL=="eth", NAME="eth0"

    PCI device 0x8086:0x1026 (e1000)

    SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?", ATTR{address}=="00:0e:0c:aa:c0:a8", ATTR{type}=="1", KERNEL=="eth", NAME="eth1"

    – Ujjwal Jul 11 '14 at 08:41
  • excuse me for the formatting. I'm not able to allow line breaks. – Ujjwal Jul 11 '14 at 08:45
  • It is probably an issue on 6.5, it worked fine on older version 6.4. – Ujjwal Jul 11 '14 at 09:45
0

It is probably an issue with CentOS 6.5. It worked fine when tried on CentOS 6.4. The IPs on the interface are retained.

Ujjwal
  • 11