]> git.proxmox.com Git - mirror_ovs.git/commitdiff
Replace most uses of and references to "ifconfig" by "ip".
authorBen Pfaff <blp@ovn.org>
Thu, 1 Jun 2017 14:21:41 +0000 (07:21 -0700)
committerBen Pfaff <blp@ovn.org>
Thu, 1 Jun 2017 14:21:41 +0000 (07:21 -0700)
It's becoming more common that OSes include "ip" but not "ifconfig", so
it's best to avoid using the latter.  This commit removes most references
to "ifconfig" and replaces them by "ip".  It also adds a build-time check
to make it harder to introduce new uses of "ifconfig".

There are important differences between "ifconfig" and "ip":

- An "ifconfig" command that sets an IP address also brings the interface
  up, but a similar "ip addr add" command does not, so it is often necessary
  (or at least precautionary) to add an "ip link set <dev> up" command.

- "ifconfig" can infer a netmask from an IP adddress, but "ip" always
  assumes /32 if none is given.

- "ifconfig" with address 0.0.0.0 removes any configured IP address, but
  "ip addr add" does not, so "ifconfig <dev> 0.0.0.0" must be replaced by
  "ip addr del" or "ip addr flush".

Signed-off-by: Ben Pfaff <blp@ovn.org>
18 files changed:
Documentation/faq/configuration.rst
Documentation/faq/issues.rst
Documentation/faq/vlan.rst
Documentation/howto/dpdk.rst
Documentation/howto/kvm.rst
Documentation/howto/userspace-tunneling.rst
Documentation/ref/ovs-vlan-test.8.rst
Documentation/tutorials/ovs-advanced.rst
Makefile.am
python/ovstest/rpcserver.py
python/ovstest/util.py
python/ovstest/vswitch.py
tests/interface-reconfigure.at
utilities/bugtool/ovs-bugtool.in
utilities/ovs-ofctl.8.in
utilities/ovs-vsctl.8.in
xenserver/opt_xensource_libexec_InterfaceReconfigureVswitch.py
xenserver/opt_xensource_libexec_interface-reconfigure

index 8bd0e1104d518b413947f5430c54aaab5b1a78af..1c93a55cc7206bceced25fb4011ea8a89edd66ef 100644 (file)
@@ -83,7 +83,7 @@ Q: Does Open vSwitch support configuring a port in promiscuous mode?
       destined to a host are delivered to the host's NIC.
 
       This form of promiscuous mode is configured in the guest OS of the VMs on
-      your bridge, e.g. with "ifconfig".
+      your bridge, e.g. with "ip link set <device> promisc".
 
     - The VMware vSwitch uses a different definition of "promiscuous mode".
       When you configure promiscuous mode on a VMware vNIC, the vSwitch sends a
index c60336a105692b104b5766f1cb65d68793050d27..f26eebd0d783c8b6bcd262835ea1fdfb8065922e 100644 (file)
@@ -43,8 +43,9 @@ eth0.  Help!
     itself.  For example, assuming that eth0's IP address is 192.168.128.5, you
     could run the commands below to fix up the situation::
 
-        $ ifconfig eth0 0.0.0.0
-        $ ifconfig br0 192.168.128.5
+        $ ip addr flush dev eth0
+        $ ip addr add 192.168.128.5/24 dev br0
+        $ ip link set br0 up
 
     (If your only connection to the machine running OVS is through the IP
     address in question, then you would want to run all of these commands on a
@@ -56,7 +57,7 @@ eth0.  Help!
     client that was listening on the physical Ethernet interface (e.g. eth0)
     and start one listening on the internal interface (e.g. br0).  You might
     still need to manually clear the IP address from the physical interface
-    (e.g. with "ifconfig eth0 0.0.0.0").
+    (e.g. with "ip addr flush dev eth0").
 
     There is no compelling reason why Open vSwitch must work this way.
     However, this is the way that the Linux kernel bridge module has always
@@ -285,7 +286,8 @@ Q: I created a tap device tap0, configured an IP address on it, and added it to
 a bridge, like this::
 
     $ tunctl -t tap0
-    $ ifconfig tap0 192.168.0.123
+    $ ip addr add 192.168.0.123/24 dev tap0
+    $ ip link set tap0 up
     $ ovs-vsctl add-br br0
     $ ovs-vsctl add-port br0 tap0
 
@@ -299,13 +301,15 @@ network, but it doesn't work.  Why not?
 
         $ ovs-vsctl add-br br0
         $ ovs-vsctl add-port br0 int0 -- set Interface int0 type=internal
-        $ ifconfig int0 192.168.0.123
+       $ ip addr add 192.168.0.123/24 dev int0
+        $ ip link set int0 up
 
     Even more simply, you can take advantage of the internal port that every
     bridge has under the name of the bridge::
 
         $ ovs-vsctl add-br br0
-        $ ifconfig br0 192.168.0.123
+       $ ip addr add 192.168.0.123/24 dev br0
+        $ ip link set br0 up
 
     In more detail, a "tap" device is an interface between the Linux (or BSD)
     network stack and a user program that opens it as a socket.  When the "tap"
@@ -380,9 +384,8 @@ keep changing internal ports MTU?
     A: By default Open vSwitch overrides the internal interfaces (e.g. br0)
     MTU.  If you have just an internal interface (e.g. br0) and a physical
     interface (e.g. eth0), then every change in MTU to eth0 will be reflected
-    to br0.  Any manual MTU configuration using `ip` or `ifconfig` on internal
-    interfaces is going to be overridden by Open vSwitch to match the current
-    bridge minimum.
+    to br0.  Any manual MTU configuration using `ip` on internal interfaces is
+    going to be overridden by Open vSwitch to match the current bridge minimum.
 
     Sometimes this behavior is not desirable, for example with tunnels.  The
     MTU of an internal interface can be explicitly set using the following
@@ -392,7 +395,7 @@ keep changing internal ports MTU?
 
     After this, Open vSwitch will configure br0 MTU to 1450.  Since this
     setting is in the database it will be persistent (compared to what happens
-    with `ip` or `ifconfig`).
+    with `ip`).
 
     The MTU configuration can be removed to restore the default behavior
     with::
index 3b09d89b9438b381acb71a266211904597066e70..991bb3d4c7a46b37711b2ea77d61fc7a38074540 100644 (file)
@@ -190,7 +190,8 @@ Q: Can I configure an IP address on a VLAN?
         $ ovs-vsctl add-port br0 eth0
         $ ovs-vsctl add-port br0 vlan9 tag=9 \
             -- set interface vlan9 type=internal
-        $ ifconfig vlan9 192.168.0.7
+       $ ip addr add 192.168.0.7/24 dev vlan9
+        $ ip link set vlan0 up
 
     See also the following question.
 
@@ -198,9 +199,11 @@ Q: I configured one IP address on VLAN 0 and another on VLAN 9, like this::
 
     $ ovs-vsctl add-br br0
     $ ovs-vsctl add-port br0 eth0
-    $ ifconfig br0 192.168.0.5
+    $ ip addr add 192.168.0.5/24 dev br0
+    $ ip link set br0 up
     $ ovs-vsctl add-port br0 vlan9 tag=9 -- set interface vlan9 type=internal
-    $ ifconfig vlan9 192.168.0.9
+    $ ip addr add 192.168.0.9/24 dev vlan9
+    $ ip link set vlan0 up
 
 but other hosts that are only on VLAN 0 can reach the IP address configured on
 VLAN 9.  What's going on?
index 7c06239d395e3ceb91819c4c9f99efb9c3f8551d..f3c7aff1f553884aeeaa53b5ce374fbda788cade 100644 (file)
@@ -262,7 +262,7 @@ vHost ports:
    and CRC lengths (i.e. 18B) from the max supported frame size.  So, to set
    the MTU for a 9018B Jumbo Frame::
 
-       $ ifconfig eth1 mtu 9000
+       $ ip link set eth1 mtu 9000
 
 When Jumbo Frames are enabled, the size of a DPDK port's mbuf segments are
 increased, such that a full Jumbo Frame of a specific size may be accommodated
@@ -564,8 +564,10 @@ testcase and packet forwarding using DPDK testpmd application in the Guest VM.
 For users wishing to do packet forwarding using kernel stack below, you need to
 run the below commands on the guest::
 
-    $ ifconfig eth1 1.1.1.2/24
-    $ ifconfig eth2 1.1.2.2/24
+    $ ip addr add 1.1.1.2/24 dev eth1
+    $ ip addr add 1.1.2.2/24 dev eth2
+    $ ip link set eth1 up
+    $ ip link set eth2 up
     $ systemctl stop firewalld.service
     $ systemctl stop iptables.service
     $ sysctl -w net.ipv4.ip_forward=1
@@ -655,8 +657,10 @@ devices to bridge ``br0``. Once complete, follow the below steps:
 
    Configure IP and enable interfaces::
 
-       $ ifconfig eth0 5.5.5.1/24 up
-       $ ifconfig eth1 90.90.90.1/24 up
+       $ ip addr add 5.5.5.1/24 dev eth0
+       $ ip addr add 90.90.90.1/24 dev eth1
+       $ ip link set eth0 up
+       $ ip link set eth1 up
 
    Configure IP forwarding and add route entries::
 
index 29732a9b37eddbc5ace6d674620c217249a1b5cc..1ad2d979c3091472aac6b6023e9af4a69f5006df 100644 (file)
@@ -50,7 +50,7 @@ Create the following two files and store them in known locations. For example::
     #!/bin/sh
 
     switch='br0'
-    /sbin/ifconfig $1 0.0.0.0 up
+    ip link set $1 up
     ovs-vsctl add-port ${switch} $1
     EOF
 
@@ -60,7 +60,8 @@ Create the following two files and store them in known locations. For example::
     #!/bin/sh
 
     switch='br0'
-    /sbin/ifconfig $1 0.0.0.0 down
+    ip addr flush dev $1
+    ip link set $1 down
     ovs-vsctl del-port ${switch} $1
     EOF
 
index d978b3025cf8c58523d31fba76b7d2f4dd310ad5..0b488195370b00ee7ba8f3f8dd6d604372a50977 100644 (file)
@@ -103,6 +103,7 @@ Perform the folowing configuration on `host1`:
 #. Configure the IP address of the VM interface *in the VM itself*::
 
        $ ip addr add 192.168.1.1/24 dev eth0
+       $ ip link set eth0 up
 
 #. On `host1`, add a port for the VXLAN tunnel::
 
index 59993817562e6e35b66259153a7d2d54d3d98f10..d4fbabbdf39e4236be374abab1f93c422f089868 100644 (file)
@@ -93,7 +93,8 @@ with VLAN tag 10::
       -- add-port vlan-br eth1 \
       -- add-port vlan-br vlan-br-tag tag=10 \
       -- set Interface vlan-br-tag type=internal
-    ifconfig vlan-br-tag up 1.2.3.4
+    ip addr add 1.2.3.4/8 dev vlan-br-tag
+    ip link set vlan-br-tag up
 
 Run an :program:`ovs-vlan-test` server listening for client control traffic on
 `172.16.0.142` port `8080` and VLAN traffic on the default port of `1.2.3.3`::
index 15785cf5b300a86493daf5ebdd4975aaf59612da..676137f3cd280a4afa673eb044963d9532dbb129 100644 (file)
@@ -103,10 +103,9 @@ From Open vSwitch's perspective, the bridge that you create this way is as real
 as any other.  You can, for example, connect it to an OpenFlow controller or
 use ``ovs-ofctl`` to examine and modify it and its OpenFlow flow table.  On the
 other hand, the bridge is not visible to the operating system's network stack,
-so ``ifconfig`` or ``ip`` cannot see it or affect it, which means that
-utilities like ``ping`` and ``tcpdump`` will not work either.  (That has its
-good side, too: you can't screw up your computer's network stack by
-manipulating a sandboxed OVS.)
+so ``ip`` cannot see it or affect it, which means that utilities like ``ping``
+and ``tcpdump`` will not work either.  (That has its good side, too: you can't
+screw up your computer's network stack by manipulating a sandboxed OVS.)
 
 When you're done using OVS from the sandbox, exit the nested shell (by entering
 the "exit" shell command or pressing Control+D).  This will kill the daemons
@@ -267,9 +266,9 @@ In addition to adding a port, the ``ovs-vsctl`` command above sets its
   we can talk about OpenFlow port 1 and know that it corresponds to ``p1``.
 
 The ``ovs-ofctl`` command above brings up the simulated interfaces, which are
-down initially, using an OpenFlow request.  The effect is similar to ``ifconfig
+down initially, using an OpenFlow request.  The effect is similar to ``ip link
 up``, but the sandbox's interfaces are not visible to the operating system and
-therefore ``ifconfig`` would not affect them.
+therefore ``ip`` would not affect them.
 
 We have not configured anything related to VLANs or MAC learning.  That's
 because we're going to implement those features in the flow table.
index 4a6b5e5747faee8318b9fa75a5602a42b37bb7fd..d810a5e72c72e436762ec3147154a6fdcaefcaa6 100644 (file)
@@ -311,6 +311,20 @@ thread-safety-check:
 EXTRA_DIST += build-aux/thread-safety-blacklist
 .PHONY: thread-safety-check
 
+# Check that "ip" is used in preference to "ifconfig", because
+# "ifconfig" is not installed ubiquitously anymore.
+ALL_LOCAL += check-ifconfig
+check-ifconfig:
+       @if test -e $(srcdir)/.git && (git --version) >/dev/null 2>&1 && \
+         (cd $(srcdir) && git --no-pager grep -l -E -e 'ifconfig' | \
+           $(EGREP) -v 'Makefile.am|ovs-vsctl-bashcomp|openvswitch-custom\.te'); \
+       then \
+         echo "See above for list of files that use or reference"; \
+          echo "'ifconfig'.  Please use 'ip' instead."; \
+         exit 1; \
+       fi
+.PHONY: check-ifconfig
+
 if HAVE_GROFF
 ALL_LOCAL += manpage-check
 manpage-check: $(man_MANS) $(dist_man_MANS) $(noinst_man_MANS)
index ca473e01ddc20cf712fc9da43e120f7f20f1f16e..ab5b7e89e63af5f67255e961669052ef94d02856 100644 (file)
@@ -240,13 +240,15 @@ class TestArena(xmlrpc.XMLRPC):
             util.interface_up(bridge)
             (ip_addr, mask) = util.interface_get_ip(iface)
             util.interface_assign_ip(bridge, ip_addr, mask)
+            util.interface_up(bridge)
             util.move_routes(iface, bridge)
-            util.interface_assign_ip(iface, "0.0.0.0", "255.255.255.255")
+            util.interface_remove_ip(iface, ip_addr, mask)
             ret = vswitch.ovs_vsctl_add_port_to_bridge(bridge, iface)
             if ret == 0:
                 self.ports.add(iface)
             else:
                 util.interface_assign_ip(iface, ip_addr, mask)
+                util.interface_up(iface)
                 util.move_routes(bridge, iface)
                 vswitch.ovs_vsctl_del_bridge(bridge)
 
@@ -327,6 +329,12 @@ class TestArena(xmlrpc.XMLRPC):
         """
         return util.interface_assign_ip(iface, ip_address, mask)
 
+    def xmlrpc_interface_remove_ip(self, iface, ip_address, mask):
+        """
+        This function allows to assing ip address to the given interface.
+        """
+        return util.interface_remove_ip(iface, ip_address, mask)
+
     def xmlrpc_get_interface(self, address):
         """
         Finds first interface that has given address
index 839c9e7dac6145c86077879b8442b9b271178b69..db2ae989a2bd396534cda77b0d8cd0ec1599b3b5 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (c) 2011, 2012 Nicira, Inc.
+# Copyright (c) 2011, 2012, 2017 Nicira, Inc.
 #
 # Licensed under the Apache License, Version 2.0 (the "License");
 # you may not use this file except in compliance with the License.
@@ -107,23 +107,42 @@ def interface_up(iface):
     """
     This function brings given iface up.
     """
-    ret, _out, _err = start_process(["ifconfig", iface, "up"])
+    ret, _out, _err = start_process(["ip", "link", "set", iface, "up"])
     return ret
 
 
 def interface_assign_ip(iface, ip_addr, mask):
     """
-    This function allows to assign IP address to an interface. If mask is an
-    empty string then ifconfig will decide what kind of mask to use. The
-    caller can also specify the mask by using CIDR notation in ip argument by
-    leaving the mask argument as an empty string. In case of success this
-    function returns 0.
+    This function adds an IP address to an interface. If mask is None
+    then a mask will be selected automatically.  In case of success
+    this function returns 0.
     """
-    args = ["ifconfig", iface, ip_addr]
+    interface_ip_op(iface, ip_addr, mask, "add")
+
+
+def interface_remove_ip(iface, ip_addr, mask):
+    """
+    This function removes an IP address from an interface. If mask is
+    None then a mask will be selected automatically.  In case of
+    success this function returns 0.
+    """
+    interface_ip_op(iface, ip_addr, mask, "del")
+
+
+def interface_ip_op(iface, ip_addr, mask, op):
     if mask is not None:
-        args.append("netmask")
-        args.append(mask)
-    ret, _out, _err = start_process(args)
+        arg = "%s/%s" % (ip_addr, mask)
+    elif '/' in ip_addr:
+        arg = ip_addr
+    else:
+        (x1, x2, x3, x4) = struct.unpack("BBBB", socket.inet_aton(ip_addr))
+        if x1 < 128:
+            arg = "%s/8" % ip_addr
+        elif x1 < 192:
+            arg = "%s/16" % ip_addr
+        else:
+            arg = "%s/24" % ip_addr
+    ret, _out, _err = start_process(["ip", "addr", op, arg, "dev", iface])
     return ret
 
 
@@ -132,14 +151,13 @@ def interface_get_ip(iface):
     This function returns tuple - ip and mask that was assigned to the
     interface.
     """
-    args = ["ifconfig", iface]
+    args = ["ip", "addr", "show", iface]
     ret, out, _err = start_process(args)
 
     if ret == 0:
-        ip = re.search(r'inet addr:(\S+)', out)
-        mask = re.search(r'Mask:(\S+)', out)
-        if ip is not None and mask is not None:
-            return (ip.group(1), mask.group(1))
+        ip = re.search(r'inet (\S+)/(\S+)', out)
+        if ip is not None:
+            return (ip.group(1), ip.group(2))
     else:
         return ret
 
index 1c6726ea0cc2c90903aad331163a2c74f4b64411..9d5b5cffd00237afcf758b152a2e25c0af46cc25 100644 (file)
@@ -41,6 +41,7 @@ def ovs_vsctl_del_pbridge(bridge, iface):
     """
     (ip_addr, mask) = util.interface_get_ip(bridge)
     util.interface_assign_ip(iface, ip_addr, mask)
+    util.interface_up(iface)
     util.move_routes(bridge, iface)
     return ovs_vsctl_del_bridge(bridge)
 
index b4e455d94228e7040465d1f114b94fed2f8fab8a..a4c0dca07569ea18dfabb8dabbc4747e189d1a60 100644 (file)
@@ -34,7 +34,6 @@ EOF
 
         for utility in \
             sbin/ethtool \
-            sbin/ifconfig \
             sbin/ifdown \
             sbin/ifup \
             sbin/ip \
@@ -715,7 +714,7 @@ configure_datapath: extra bonds - []
 Applying changes to /etc/sysconfig/network-scripts/route-xenbr2 configuration
 Applying changes to /etc/sysconfig/network configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xenbr2 configuration
-/sbin/ifconfig eth2 up mtu 1500
+/sbin/ip link set eth2 up mtu 1500
 /sbin/ethtool -K eth2 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth2 on
 /usr/bin/ovs-vsctl --timeout=20
@@ -763,7 +762,7 @@ action_down: xenbr2
 deconfigure ipdev xenbr2 on xenbr2
 deconfigure_bridge: bridge           - xenbr2
 action_down: bring down physical devices - ['eth2']
-/sbin/ifconfig eth2 down
+/sbin/ip link set eth2 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xenbr2
     --if-exists del-br xenbr2
@@ -790,7 +789,7 @@ configure_datapath: extra ports - []
 configure_datapath: extra bonds - []
 Applying changes to /etc/sysconfig/network-scripts/route-xapi3 configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi3 configuration
-/sbin/ifconfig eth3 up mtu 1500
+/sbin/ip link set eth3 up mtu 1500
 /sbin/ethtool -K eth3 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth3 on
 /usr/bin/ovs-vsctl --timeout=20
@@ -837,7 +836,7 @@ deconfigure_bridge: bridge           - xapi3
 action_down: no more masters, bring down slave xenbr3
 deconfigure_bridge: bridge           - xenbr3
 action_down: bring down physical devices - ['eth3']
-/sbin/ifconfig eth3 down
+/sbin/ip link set eth3 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi3
     --if-exists del-br xapi3
@@ -876,10 +875,10 @@ netdev: down: device xenbr0 does not exist, ignoring
 netdev: down: device xenbr1 does not exist, ignoring
 Applying changes to /etc/sysconfig/network-scripts/route-xapi1 configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
-/sbin/ifconfig eth0 up mtu 1500
+/sbin/ip link set eth0 up mtu 1500
 /sbin/ethtool -K eth0 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth0 on
-/sbin/ifconfig eth1 up mtu 1500
+/sbin/ip link set eth1 up mtu 1500
 /sbin/ethtool -K eth1 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth1 off
 /usr/bin/ovs-vsctl --timeout=20
@@ -897,7 +896,7 @@ Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
     br-set-external-id xapi1 xs-network-uuids 45cbbb43-113d-a712-3231-c6463f253cef;99be2da4-6c33-6f8e-49ea-3bc592fe3c85
 /sbin/ifup xapi1
 action_up: bring up bond0
-/sbin/ifconfig bond0 up
+/sbin/ip link set bond0 up
 /sbin/update-issue
 Committing changes to /etc/sysconfig/network-scripts/route-xapi1 configuration
 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xapi1 configuration
@@ -927,8 +926,8 @@ action_down: xapi1
 deconfigure ipdev xapi1 on xapi1
 deconfigure_bridge: bridge           - xapi1
 action_down: bring down physical devices - ['eth0', 'eth1']
-/sbin/ifconfig eth0 down
-/sbin/ifconfig eth1 down
+/sbin/ip link set eth0 down
+/sbin/ip link set eth1 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi1
     --if-exists del-br xapi1
@@ -966,10 +965,10 @@ netdev: down: device xenbr0 does not exist, ignoring
 netdev: down: device xenbr1 does not exist, ignoring
 Applying changes to /etc/sysconfig/network-scripts/route-xapi2 configuration
 Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
-/sbin/ifconfig eth0 up mtu 1500
+/sbin/ip link set eth0 up mtu 1500
 /sbin/ethtool -K eth0 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth0 on
-/sbin/ifconfig eth1 up mtu 1500
+/sbin/ip link set eth1 up mtu 1500
 /sbin/ethtool -K eth1 gro off lro off
 /usr/sbin/ovs-vlan-bug-workaround eth1 off
 /usr/bin/ovs-vsctl --timeout=20
@@ -991,7 +990,7 @@ Applying changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
     set Interface xapi2 MAC="00:22:19:22:4b:af"
 /sbin/ifup xapi2
 action_up: bring up bond0
-/sbin/ifconfig bond0 up
+/sbin/ip link set bond0 up
 /sbin/update-issue
 Committing changes to /etc/sysconfig/network-scripts/route-xapi2 configuration
 Committing changes to /etc/sysconfig/network-scripts/ifcfg-xapi2 configuration
@@ -1023,8 +1022,8 @@ deconfigure_bridge: bridge           - xapi2
 action_down: no more masters, bring down slave xapi1
 deconfigure_bridge: bridge           - xapi1
 action_down: bring down physical devices - ['eth0', 'eth1']
-/sbin/ifconfig eth0 down
-/sbin/ifconfig eth1 down
+/sbin/ip link set eth0 down
+/sbin/ip link set eth1 down
 /usr/bin/ovs-vsctl --timeout=20
     --with-iface --if-exists del-port xapi2
     --if-exists del-br xapi2
index 506e42876934bbf6c1a13461c5de9ee8f8d7a44e..5eb3440b7b2c458f249d9c85511900cdfe88b01f 100755 (executable)
@@ -14,7 +14,7 @@
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #
 # Copyright (c) 2005, 2007 XenSource Ltd.
-# Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016 Nicira, Inc.
+# Copyright (c) 2010, 2011, 2012, 2013, 2015, 2016, 2017 Nicira, Inc.
 
 #
 # To add new entries to the bugtool, you need to:
@@ -137,7 +137,7 @@ DPKG_QUERY = 'dpkg-query'
 ETHTOOL = 'ethtool'
 FDISK = 'fdisk'
 FIND = 'find'
-IFCONFIG = 'ifconfig'
+IP = 'ip'
 IPTABLES = 'iptables'
 ISCSIADM = 'iscsiadm'
 LOSETUP = 'losetup'
@@ -582,7 +582,7 @@ exclude those logs from the archive.
     file_output(CAP_NETWORK_CONFIG, [OPENVSWITCH_DEFAULT_SWITCH,
                 OPENVSWITCH_SYSCONFIG_SWITCH])
 
-    cmd_output(CAP_NETWORK_INFO, [IFCONFIG, '-a'])
+    cmd_output(CAP_NETWORK_INFO, [IP, 'addr', 'show'])
     cmd_output(CAP_NETWORK_INFO, [ROUTE, '-n'])
     cmd_output(CAP_NETWORK_INFO, [ARP, '-n'])
     cmd_output(CAP_NETWORK_INFO, [NETSTAT, '-an'])
index 86f019fdb6d2d8ab61d6203ab295e6d0c84b4f15..3b86c0d73c1c3fd3c87d832b3456d02c47fa9f5b 100644 (file)
@@ -136,8 +136,8 @@ may be any one of the following:
 .RS
 .IQ \fBup\fR
 .IQ \fBdown\fR
-Enable or disable the interface.  This is equivalent to \fBifconfig
-up\fR or \fBifconfig down\fR on a Unix system.
+Enable or disable the interface.  This is equivalent to \fBip
+link set up\fR or \fBip link set down\fR on a Unix system.
 .
 .IP \fBstp\fR
 .IQ \fBno\-stp\fR
index 6aca267a70675f3457975ae60324e74bf8ffc9a8..e5e565e8a58aba5c752d674849176d00371bc376 100644 (file)
@@ -600,7 +600,7 @@ access port for VLAN 10, and configure it with an IP address:
 .IP
 .B "ovs\-vsctl add\-port br0 vlan10 tag=10 \-\- set Interface vlan10 type=internal"
 .IP
-.B "ifconfig vlan10 192.168.0.123"
+.B "ip addr add 192.168.0.123/24 dev vlan10"
 .
 .PP
 Add a GRE tunnel port \fBgre0\fR to remote IP address 1.2.3.4 to
index c65fb3da44fc036e17762532e08042c0cfc14946..53468b7064e55a9caacf9046533ae8d6e7d16822 100644 (file)
@@ -1,5 +1,5 @@
 # Copyright (c) 2008,2009,2011 Citrix Systems, Inc.
-# Copyright (c) 2009,2010,2011,2012,2013 Nicira, Inc.
+# Copyright (c) 2009,2010,2011,2012,2013,2017 Nicira, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU Lesser General Public License as published
@@ -25,7 +25,7 @@ def netdev_down(netdev):
     if not netdev_exists(netdev):
         log("netdev: down: device %s does not exist, ignoring" % netdev)
         return
-    run_command(["/sbin/ifconfig", netdev, 'down'])
+    run_command(["/sbin/ip", "link", "set", netdev, 'down'])
 
 def netdev_up(netdev, mtu=None):
     """Bring up a bare network device"""
@@ -37,7 +37,7 @@ def netdev_up(netdev, mtu=None):
     else:
         mtu = []
 
-    run_command(["/sbin/ifconfig", netdev, 'up'] + mtu)
+    run_command(["/sbin/ip", "link", "set", netdev, 'up'] + mtu)
 
 # This is a list of drivers that do support VLAN tx or rx acceleration, but
 # to which the VLAN bug workaround should not be applied.  This could be
index ea4a7421facfc0aa506244ccc91b255dd936f492..a82043fb5b12e9eedf117c9be341332c3b62368d 100755 (executable)
@@ -147,7 +147,7 @@ def netdev_remap_name(pif, already_renamed=[]):
     def rename_netdev(old_name, new_name):
         raise Error("Trying to rename %s to %s - This functionality has been removed" % (old_name, new_name))
         # log("Changing the name of %s to %s" % (old_name, new_name))
-        # run_command(['/sbin/ifconfig', old_name, 'down'])
+        # run_command(['/sbin/ip', 'link', 'set', old_name, 'down'])
         # if not run_command(['/sbin/ip', 'link', 'set', old_name, 'name', new_name]):
         #     raise Error("Could not rename %s to %s" % (old_name, new_name))
 
@@ -191,7 +191,7 @@ def ifdown(netdev):
         return
     if not os.path.exists("%s/etc/sysconfig/network-scripts/ifcfg-%s" % (root_prefix(), netdev)):
         log("ifdown: device %s exists but ifcfg-%s does not" % (netdev,netdev))
-        run_command(["/sbin/ifconfig", netdev, 'down'])
+        run_command(["/sbin/ip", "link", "set", netdev, 'down'])
         return
     run_command(["/sbin/ifdown", netdev])