Jianwei Hu
2014-May-23 03:46 UTC
[libvirt-users] [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
Hi All, I have a usage question about netcf. Why netcf can not rename a existing physical interface dynamically by itself? If you have any other method, please share to me, or can we add support for it in netcf? You can see the following steps for details. Version: netcf-0.2.4-1.el6.x86_64 kernel-2.6.32-431.el6.x86_64 1. Select a existing NIC from host, for example eth1. [root@rhel6 ~]# ncftool list --all eth0 eth1 lo [root@rhel6 ~]# ncftool dumpxml eth1 <?xml version="1.0"?> <interface type="ethernet" name="eth1"> <start mode="none"/> <mac address="00:1B:21:27:4E:CE"/> <protocol family="ipv4"> <dhcp/> </protocol> </interface> [root@rhel6 ~]# ifconfig eth1 eth1 Link encap:Ethernet HWaddr 00:1B:21:27:4E:CE BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) [root@rhel6 ~]# ncftool ifup eth1 Interface eth1 successfully brought up 2. Undefine eth1 from host [root@rhel6 ~]# ncftool ifdown eth1 Interface eth1 successfully brought down [root@rhel6 ~]# ncftool undefine eth1 eth1 undefined [root@rhel6 ~]# ncftool list --all eth0 lo 3. Prepare another xml with same MAC and a new name "jiahu" [root@rhel6 ~]# cat jiahu.xml <interface type="ethernet" name="jiahu"> <start mode="none"/> <mac address="00:1B:21:27:4E:CE"/> <protocol family="ipv4"> <dhcp/> </protocol> </interface> 4. Define the "jiahu", and start it. [root@rhel6 ~]# ncftool define jiahu.xml Defined interface jiahu [root@rhel6 ~]# ncftool dumpxml jiahu <?xml version="1.0"?> <interface type="ethernet" name="jiahu"> <start mode="none"/> <mac address="00:1B:21:27:4E:CE"/> <protocol family="ipv4"> <dhcp/> </protocol> </interface> [root@rhel6 ~]# ifconfig jiahu jiahu: error fetching interface information: Device not found [root@rhel6 ~]# cat /etc/sysconfig/network-scripts/ifcfg-jiahu DEVICE=jiahu HWADDR=00:1B:21:27:4E:CE ONBOOT=no BOOTPROTO=dhcp [root@rhel6 ~]# ncftool ifup jiahu Interface jiahu bring-up failed! error: failed to execute external program error: Running 'ifup jiahu' failed with exit code 1: Device jiahu does not seem to be present, delaying initialization. [root@rhel6 ~]# ll /sys/class/net/ total 0 lrwxrwxrwx. 1 root root 0 May 23 11:32 eth0 -> ../../devices/pci0000:00/0000:00:19.0/net/eth0 lrwxrwxrwx. 1 root root 0 May 23 11:35 eth1 -> ../../devices/pci0000:00/0000:00:1e.0/0000:02:00.0/net/eth1 lrwxrwxrwx. 1 root root 0 May 23 11:32 lo -> ../../devices/virtual/net/lo lrwxrwxrwx. 1 root root 0 May 23 11:32 virbr0 -> ../../devices/virtual/net/virbr0 lrwxrwxrwx. 1 root root 0 May 23 11:32 virbr0-nic -> ../../devices/virtual/net/virbr0-nic 5. Reboot the host OS, the jiahu interface appeared. [root@rhel6 ~]# ifconfig jiahu jiahu Link encap:Ethernet HWaddr 00:1B:21:27:4E:CE BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) BR, Jianwei
Laine Stump
2014-May-23 08:56 UTC
Re: [libvirt-users] [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
On 05/23/2014 06:46 AM, Jianwei Hu wrote:> Hi All, > > I have a usage question about netcf. Why netcf can not rename a existing physical interface dynamically by itself?The name of a physical interface is determined by lower levels of the operating system, and can't be modified by netcf. the configuration that is setup by netcf can only reference an *existing* physical device name, it can't rename it.> If you have any other method, please share to me, or can we add support for it in netcf?One source of information is here: http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ (although that only completely applies to systems running recent systemd, e.g. Fedora 20, but not to RHEL6 as you appear to be running) There is a reference there of how to change an interface name in a system that isn't using "predictable network interface names" (or biosdevname, which was a short-lived alternative attempt at a solution to the same problem): modify the file /etc/udev/rules.d/70-persistent-net.rules. You'll need to reboot the system for this to take effect.
jiahu
2014-May-23 12:02 UTC
Re: [libvirt-users] [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
On 05/23/2014 04:56 PM, Laine Stump wrote:> On 05/23/2014 06:46 AM, Jianwei Hu wrote: >> Hi All, >> >> I have a usage question about netcf. Why netcf can not rename a existing physical interface dynamically by itself? > The name of a physical interface is determined by lower levels of the > operating system, and can't be modified by netcf. the configuration that > is setup by netcf can only reference an *existing* physical device nam[root@rhel6 ~]# ip link set name jiahu eth1 > [root@rhel6 ~]# ifconfig jiahu > jiahu Link encap:Ethernet HWaddr 00:1B:21:27:4E:CE > BROADCAST MULTICAST MTU:1500 Metric:1 > RX packets:0 errors:0 dropped:0 overruns:0 frame:0 > TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 > collisions:0 txqueuelen:1000 > RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) > > [root@rhel6 ~]# ifup jiahu > > Determining IP information for jiahu... done. > e, > it can't rename it.OK, thanks, but I think we can use ip command line to rename existing NIC. [root@rhel6 ~]# ip link set name jiahu eth1 [root@rhel6 ~]# ifconfig jiahu jiahu Link encap:Ethernet HWaddr 00:1B:21:27:4E:CE BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) [root@rhel6 ~]# ifup jiahu Determining IP information for jiahu... done.>> If you have any other method, please share to me, or can we add support for it in netcf? > One source of information is here: > > > http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ > > (although that only completely applies to systems running recent > systemd, e.g. Fedora 20, but not to RHEL6 as you appear to be running) > > There is a reference there of how to change an interface name in a > system that isn't using "predictable network interface names" (or > biosdevname, which was a short-lived alternative attempt at a solution > to the same problem): modify the file > /etc/udev/rules.d/70-persistent-net.rules. You'll need to reboot the > system for this to take effect. >
Possibly Parallel Threads
- [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
- Re: [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
- [netcf]IFF_RUNNING flag on a bridge device
- Re: [netcf] Why netcf can not rename a existing physical interface dynamically by itself?
- Re: [netcf]IFF_RUNNING flag on a bridge device