tools/docs: Fix example and default IP addresses.
authorKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Jan 2008 15:13:40 +0000 (15:13 +0000)
committerKeir Fraser <keir.fraser@citrix.com>
Thu, 17 Jan 2008 15:13:40 +0000 (15:13 +0000)
In various places in documentation and code, IP addresses are provided
as examples, defaults, or dummy configuration.  In general the
specific IP addresses used in Xen are not always appropriate.  (For
example, 1.2.3.4 is used in a few places!)

The following addresses should be used:
 * For examples and documentation, 192.0.2.0/24.  (See RFC3330.)
 * For defaults for private networks, a random network from RFC1918.
   I have randomly selected 172.30.206.0/24 for this purpose and
   documented this in at the only registry I know of,
   www.ucam.org/cam-grin.  This network should henceforth be used for
   default configurations of local bridges, test networks, etc. in
   Xen tools.

The following addresses should NOT be used:
 * 10.0.*.*, 10.1.*.*, 192.168.0.*, 192.168.1.*, etc.  Using these
   addresses gives greatly increased likelihood of collision, as
   ignorant network administrators and reckless middlebox vendors
   often pick networks from the bottom of 10/8 and 192.168/16.
 * 169.254.*.*.  These are reserved for zeroconf (ad-hoc networking)
   and should not be used for Xen private networks, bridges, etc.,
   etc.  Use of these addresses by Xen scripts causes trouble on hosts
   (eg laptops) which find themselves in ad-hoc networking
   environments.  I think this is not hypothetical (!) since at least
   one Linux distribution have specific code to detect this case and
   cause Xen startup to fail iff the host already has an external
   zeroconf address.
 * 1.2.3.4.  WTF !?

I have also used 127.0.255.255 in one place where apparently a dummy
address is needed (some Linux kernels won't accept a lack of an NFS
server address).  If 127.0.255.255 is mistakenly used it is unlikely
to do any damage to real traffic even if it does escape into the
network at large.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
16 files changed:
docs/man/xend-config.sxp.pod.5
docs/src/user.tex
tools/examples/network-nat
tools/examples/xeninfo.pl
tools/examples/xmexample1
tools/examples/xmexample2
tools/python/xen/sv/CreateDomain.py
tools/python/xen/xm/create.py
tools/python/xen/xm/tests/test_create.py
tools/vnet/doc/man/vn.pod.1
tools/vnet/doc/vnet-xend.txt
tools/xm-test/Writing_Tests_HOWTO
tools/xm-test/configure.ac
tools/xm-test/lib/XmTestLib/NetConfig.py
tools/xm-test/tests/restore/04_restore_withdevices_pos.py
tools/xm-test/tests/xapi/03_xapi-network_pos.py

index 5f949dee3bce5087b494f4917a3422061037968d..3851bba3b46793ae97c09215e7923b4af93a6c4b 100644 (file)
@@ -124,7 +124,7 @@ An example configuration with relocation enabled for the local network:
 =over 4
 
  (xend-relocation-server yes)
- (xend-relocation-address 192.168.1.1)
+ (xend-relocation-address 192.0.2.192)
  (network-script network-bridge)
  (vif-script vif-bridge)
  (dom0-min-mem 0)
index c1c0a35e7405ba4aa3f2ac845a3c6f5573a4f4db..c6884c0040287ab04a79fae0a9f3fced44caeb9f 100644 (file)
@@ -1807,7 +1807,7 @@ network by adding a line to \path{/etc/exports}, for instance:
 \begin{quote}
   \begin{small}
 \begin{verbatim}
-/export/vm1root      1.2.3.4/24 (rw,sync,no_root_squash)
+/export/vm1root      192.0.2.4/24 (rw,sync,no_root_squash)
 \end{verbatim}
   \end{small}
 \end{quote}
@@ -2076,7 +2076,7 @@ iptables -A INPUT -p tcp --destination-port 8002 -j REJECT
 
 # this command enables Xen relocations only from the specific
 # subnet:
-iptables -I INPUT -p tcp -{}-source 192.168.1.1/8 \
+iptables -I INPUT -p tcp -{}-source 192.0.2.0/24 \
     --destination-port 8002 -j ACCEPT
 \end{verbatim}
 
@@ -5121,9 +5121,9 @@ vnets are working by configuring IP addresses on these interfaces
 and trying to ping them across the network. For example, using machines
 hostA and hostB:
 \begin{verbatim}
-hostA# ifconfig vnif0004 10.0.0.100 up
-hostB# ifconfig vnif0004 10.0.0.101 up
-hostB# ping 10.0.0.100
+hostA# ifconfig vnif0004 192.0.2.100 up
+hostB# ifconfig vnif0004 192.0.2.101 up
+hostB# ping 192.0.2.100
 \end{verbatim}
 
 The vnet implementation uses IP multicast to discover vnet interfaces, so
@@ -5144,8 +5144,8 @@ on the vnet UDP port:
 \end{verbatim}
 
 If multicast is not being forwarded between machines you can configure
-multicast forwarding using vn. Suppose we have machines hostA on 10.10.0.100
-and hostB on 10.11.0.100 and that multicast is not forwarded between them.
+multicast forwarding using vn. Suppose we have machines hostA on 192.0.2.200
+and hostB on 192.0.2.211 and that multicast is not forwarded between them.
 We use vn to configure each machine to forward to the other:
 \begin{verbatim}
 hostA# vn peer-add hostB
index 62d2b0c259722771b927475a700af0b398652eb2..165d92ca6826867cb492d96534a0982cb8690ed5 100644 (file)
@@ -43,9 +43,9 @@ fi
 
 function dhcp_start()
 {
-  if ! grep -q "subnet 10.0.0.0" "$dhcpd_conf_file"
+  if ! grep -q "subnet 192.0.2.0" "$dhcpd_conf_file"
   then
-    echo >>"$dhcpd_conf_file" "subnet 10.0.0.0 netmask 255.255.0.0 {}"
+    echo >>"$dhcpd_conf_file" "subnet 192.0.2.0 netmask 255.255.255.0 {}"
   fi
 
   "$dhcpd_init_file" restart
@@ -55,7 +55,7 @@ function dhcp_start()
 function dhcp_stop()
 {
   local tmpfile=$(mktemp)
-  grep -v "subnet 10.0.0.0" "$dhcpd_conf_file" >"$tmpfile"
+  grep -v "subnet 192.0.2.0" "$dhcpd_conf_file" >"$tmpfile"
   if diff "$tmpfile" "$dhcpd_conf_file" >&/dev/null
   then
     rm "$tmpfile"
index 1c982ba591aeb40357ed2e7689247050376cf92b..47431c63237129063b40c835068e46720354d4f9 100644 (file)
@@ -21,10 +21,10 @@ require RPC::XML::Client;
 
 ##### CONFIG ######
 
-my %xenhosts = ("192.168.0.10" => {"port" => "9363"}, 
-                                        "192.168.0.11" => {"port" => "9363"}, 
-                                        "192.168.0.12" => {"port" => "9363"}, 
-                                        "192.168.0.13" => {"port" => "9363"});
+my %xenhosts = ("192.0.2.10" => {"port" => "9363"}, 
+                                        "192.0.2.11" => {"port" => "9363"}, 
+                                        "192.0.2.12" => {"port" => "9363"}, 
+                                        "192.0.2.13" => {"port" => "9363"});
 
 ##### CONFIG END ###
 
index fc17ca84d9c4fd41ebe4e501709ff4606db5fad3..2fd24ab84f578f91a0443c9967b44753473ec6ab 100644 (file)
@@ -135,7 +135,7 @@ root = "/dev/hda1 ro"
 # Root device for nfs.
 #root = "/dev/nfs"
 # The nfs server.
-#nfs_server = '169.254.1.0'  
+#nfs_server = '192.0.2.1'  
 # Root directory on the nfs server.
 #nfs_root   = '/full/path/to/root/directory'
 
index 4d9595c05c8f273e07ab75060266859f397d534d..4ccd61eec578ca86eb5b2c41b8a8969881f8e499 100644 (file)
@@ -171,7 +171,7 @@ root = "/dev/sda1 ro"
 # Root device for nfs.
 #root = "/dev/nfs"
 # The nfs server.
-#nfs_server = '169.254.1.0'  
+#nfs_server = '192.0.2.1'  
 # Root directory on the nfs server.
 #nfs_root   = '/full/path/to/root/directory'
 
index ee5e62eb4acdbb47fbf499747f044e0673d5a05a..748d99bca27888f33470ac94ab8ad55dac368518 100755 (executable)
@@ -103,10 +103,10 @@ class CreatePage4( Sheet ):
         Sheet.__init__( self, urlWriter, "Network settings", 4 )
         self.addControl( ListControl( 'dhcp', [('off', 'No'), ('dhcp', 'Yes')], 'Use DHCP:' ) )
         self.addControl( InputControl( 'hostname', 'hostname', 'VM Hostname:' ) )
-        self.addControl( InputControl( 'ip_addr', '1.2.3.4', 'VM IP Address:' ) )
+        self.addControl( InputControl( 'ip_addr', '192.168.1.1', 'VM IP Address:' ) )
         self.addControl( InputControl( 'ip_subnet', '255.255.255.0', 'VM Subnet Mask:' ) ) 
-        self.addControl( InputControl( 'ip_gateway', '1.2.3.4', 'VM Gateway:' ) )           
-        self.addControl( InputControl( 'ip_nfs', '1.2.3.4', 'NFS Server:' ) )  
+        self.addControl( InputControl( 'ip_gateway', '192.168.1.1', 'VM Gateway:' ) )           
+        self.addControl( InputControl( 'ip_nfs', '192.168.1.1', 'NFS Server:' ) )  
                  
 class CreateFinish( Sheet ):
 
index 297b819fdb3292ec60481eff58d8661c3663a671..440b7d4fe92e0c12f6dc4e3876d087e742565d11 100644 (file)
@@ -886,7 +886,7 @@ def preprocess_access_control(vals):
 
 def preprocess_ip(vals):
     if vals.ip or vals.dhcp != 'off':
-        dummy_nfs_server = '1.2.3.4'
+        dummy_nfs_server = '127.0.255.255'
         ip = (vals.ip
           + ':' + (vals.nfs_server or dummy_nfs_server)
           + ':' + vals.gateway
index a25ebb1fb038c15bc1137953ef3bd3a86c2a532f..fa173f683652e7c51cf05ae8dcc01f18e9bcec5a 100644 (file)
@@ -68,7 +68,7 @@ vcpus = 4
 disk = ['phy:/dev/virt-blkdev-backend/dom1,sda1,w',
 'phy:/dev/virt-blkdev-backend/usr,sda2,r']
 root = "/dev/sda1 ro"
-extra = " profile=1 GATEWAY=10.0.1.254 NETMASK=255.255.0.0 IPADDR=10.0.134.1 HOSTNAME=dom1"
+extra = " profile=1 GATEWAY=192.0.2.254 NETMASK=255.255.255.0 IPADDR=192.0.2.1 HOSTNAME=dom1"
 on_poweroff = 'destroy'
 on_reboot   = 'destroy'
 on_crash    = 'destroy'
@@ -83,7 +83,7 @@ on_crash    = 'destroy'
                  'vcpus'       : 4,
                  'nics'        : -1,
                  'root'        : '/dev/sda1 ro',
-                 'extra'       : ' profile=1 GATEWAY=10.0.1.254 NETMASK=255.255.0.0 IPADDR=10.0.134.1 HOSTNAME=dom1',
+                 'extra'       : ' profile=1 GATEWAY=192.0.2.254 NETMASK=255.255.255.0 IPADDR=192.0.2.1 HOSTNAME=dom1',
                  'on_poweroff' : 'destroy',
                  'on_reboot'   : 'destroy',
                  'on_crash'    : 'destroy',
index 6d4d550f7682bb4d46720de8d8bb9e7d2c3b169b..a7707bd509b9795980d953c3d9a7c00983ccc36d 100644 (file)
@@ -48,9 +48,9 @@ The vnet devices are fully-functional network devices, so you can add IP address
 to them and test connectivity without any vms running.
 For example, using vnif0004 on machines A and B:
 
-        A> ifconfig vnif0004 10.0.0.11
-        B> ifconfig vnif0004 10.0.0.12
-        B> ping 10.0.0.11
+        A> ifconfig vnif0004 192.0.2.11
+        B> ifconfig vnif0004 192.0.2.12
+        B> ping 192.0.2.11
 
 If the vnet device is enslaved to a bridge you will have to add the IP address
 to the bridge instead. Use C<brctl show> or C<vn vnets> to see if a vnet
index 817a307f1bfb8d32927cf7f9cdcd37f7857f8ad1..ee55d06f906975fe8daa5c222e8545d91dd1e562 100644 (file)
@@ -108,19 +108,19 @@ Its bridge and interface should appear in 'ifconfig'.
 It should also show in 'brctl show', with its attached interfaces.
 
 You can 'see into' a vnet from dom0 if you put an IP address on the bridge.
-For example, if you have vnet97 and a vm with ip addr 10.0.0.12 connected to it,
+For example, if you have vnet97 and a vm with ip addr 192.0.2.12 connected to it,
 then
 
-ifconfig vnet97 10.0.0.20 up
+ifconfig vnet97 192.0.2.20 up
 
-should let you ping 10.0.0.12 via the vnet97 bridge.
+should let you ping 192.0.2.12 via the vnet97 bridge.
 
 4) Examples
 -----------
 
 These assume a vnet with a bridge 'vnet97' has been created.
 
-Here's the full config for a vm on vnet 97, using ip addr 10.0.0.12:
+Here's the full config for a vm on vnet 97, using ip addr 192.0.2.12:
 
 (vm
  (name dom12)
@@ -130,7 +130,7 @@ Here's the full config for a vm on vnet 97, using ip addr 10.0.0.12:
  (image
   (linux
    (kernel /boot/vmlinuz-2.6-xenU)
-   (ip 10.0.0.12:1.2.3.4::::eth0:off)
+   (ip 192.0.2.12:192.0.2.4::::eth0:off)
    (root /dev/sda1)
    (args 'rw fastboot 4')
   )
@@ -149,7 +149,7 @@ If you run another vm on the same vnet:
  (image
   (linux
    (kernel /boot/vmlinuz-2.6-xenU)
-   (ip 10.0.0.11:1.2.3.4::::eth0:off)
+   (ip 192.0.2.11:192.0.2.4::::eth0:off)
    (root /dev/sda1)
    (args 'rw fastboot 4')
   )
index 84cc90e2c687bc1f063e922a59b9d64caa237df7..379b0b145c50f1088f3eac5e74d697e13c02b435 100644 (file)
@@ -104,12 +104,14 @@ routing environments in the future, the current xm-test only supports
 a bridging environment. Xm-test currently only supports a range of
 IPs, the dhcp feature will be added soon.
 
-The network tests will need to know what IPs to use. IPs are configured
-when you build xm-test. Xm-test uses the zeroconf address range by
-default, 169.254.0.1-169.254.255.255. If you'd like to set a new range,
-do so at configure time, a netmask and network address must also be defined:
-
-    # ./configure --with-net-ip-range=192.168.1.1-192.168.1.100 --with-network-address=192.168.1.0 --with-netmask=255.255.255.0
+The network tests will need to know what IPs to use. IPs are
+configured when you build xm-test. Xm-test by default a range chosen
+at random from the RFC1918 private use space, and published at
+www.ucam.org/cam-grin, 172.30.206.1-172.30.206.254 from
+172.30.206.0/24. If you'd like to set a new range, do so at configure
+time, a netmask and network address must also be defined:
+
+    # ./configure --with-net-ip-range=192.0.2.1-192.0.2.100 --with-network-address=192.0.2.0 --with-netmask=255.255.255.0
 
 The tests will not need to set network information, this is done by 
 the library once it's configured.
index bbc639bdb07b89ed5ed4851abade5217a44a8586..a92b6daa6beeb4fb2c8eedca4b837eff81fb9792 100644 (file)
@@ -56,24 +56,24 @@ else
 fi
 
 # Network needs to know ips to use: dhcp or a range of IPs in the form
-# of: 192.168.1.1-192.168.1.100
+# of: 192.0.2.1-192.0.2.100
 # If not dhcp, a netmask and network address must be supplied. Defaults to
-# zeroconf range.
-NET_IP_RANGE="169.254.0.1-169.254.255.255"
+# range allocated in www.ucam.org/cam-grin.
+NET_IP_RANGE="172.30.206.1-172.30.206.254"
 AC_ARG_WITH(net-ip-range,
-       [  --with-net-ip-range=ip-range Set a range of ip addresses to use for xm-test guest domain networks. Can specify dhcp or a range of IPs: 192.168.1.1-192.168.1.100 [[default="169.254.0.1-169.254.255.255"]]],
+       [  --with-net-ip-range=ip-range Set a range of ip addresses to use for xm-test guest domain networks. Can specify dhcp or a range of IPs: 192.0.2.1-192.0.2.100 [[default="172.30.206.1-172.30.206.254"]]],
        [ NET_IP_RANGE="$withval" ])
 
 iprange=`echo $NET_IP_RANGE | perl -e 'while(<>) { print if /\d+\.\d+\.\d+\.\d+-\d+\.\d+\.\d+\.\d+/ }'`
 
-NETWORK_ADDRESS="169.254.0.0"
+NETWORK_ADDRESS="172.30.206.0"
 AC_ARG_WITH(network-address,
-       [ --with-network-address=ip Set network address to use with ip range [[default="169.254.0.0"]]],
+       [ --with-network-address=ip Set network address to use with ip range [[default="172.30.206.0"]]],
        [ NETWORK_ADDRESS="$withval" ])
 
-NETMASK="255.255.0.0"
+NETMASK="255.255.255.0"
 AC_ARG_WITH(netmask,
-       [ --with-netmask=mask Set netmask to use with ip range [[default="255.255.0.0"]]],
+       [ --with-netmask=mask Set netmask to use with ip range [[default="255.255.255.0"]]],
        [ NETMASK="$withval" ])
 
 if test "x$NET_IP_RANGE" != "xdhcp" && test -z "$iprange"
index 919af65fdb6df8ca951b4931c505065992a45e81..0c399698066ef33b0291ae215ed83b6c707e3dc1 100644 (file)
@@ -69,12 +69,6 @@ def getXendNetConfig():
     configfile.close()
     return netenv
 
-def checkZeroconfAddresses():
-    # Make sure there aren't existing zeroconf addresses.
-    rc, out = traceCommand("ip addr show |grep \"inet 169.254\" | grep eth0")
-    if rc == 0:
-        raise NetworkError("Zeroconf addresses already used: %s" % out)
-
 class NetConfig:
 
     def __init__(self):
@@ -101,9 +95,6 @@ class NetConfig:
 
             self.__setMaxNumberIPs()
 
-            if self.network == "169.254.0.0":
-                checkZeroconfAddresses()
-
             # Clean out any aliases in the network range for dom0's interface.
             # If an alias exists, a test xendevice add command could fail.
             if NETWORK_IP_RANGE != "dhcp":
index 63b716da629edbff3f082393beaea8e796676cb2..a7a67f7c93ff1e044e9c82bac4d42bbb3eb3e63f 100644 (file)
@@ -48,11 +48,11 @@ try:
     if run["return"] != 0:
         FAIL("Unable to write to block device hdb2!")
 
-    run = console.runCmd("ifconfig eth0 169.254.0.1 netmask 255.255.255.0")
+    run = console.runCmd("ifconfig eth0 172.30.206.1 netmask 255.255.255.240")
     if run["return"] != 0:
         FAIL("Unable to configure DomU's eth0")
 
-    run = console.runCmd("ifconfig eth1 169.254.1.1 netmask 255.255.255.0")
+    run = console.runCmd("ifconfig eth1 172.30.206.17 netmask 255.255.255.240")
     if run["return"] != 0:
         FAIL("Unable to configure DomU's eth1")
 
@@ -114,11 +114,11 @@ try:
     run = console.runCmd("ifconfig")
     if not re.search("eth0", run["output"]):
         FAIL("DomU's eth0 disappeared")
-    if not re.search("169.254.0.1", run["output"]):
+    if not re.search("172.30.206.1", run["output"]):
         FAIL("DomU's eth0 lost its IP")
     if not re.search("eth1", run["output"]):
         FAIL("DomU's eth1 disappeared")
-    if not re.search("169.254.1.1", run["output"]):
+    if not re.search("172.30.206.17", run["output"]):
         FAIL("DomU's eth1 lost its IP")
     if not re.search("Loopback", run["output"]):
         FAIL("DomU's lo disappeared")
index 43ea82691d2a5111f020030d84565f2cec241c0a..9ae2daea1badd091077ef495c5de41f66b990409 100644 (file)
@@ -39,18 +39,18 @@ if status:
 # Configure IP addresses on two domains
 try:
     # Run 'ls'
-    run = console1.runCmd("ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up")
-    run = console2.runCmd("ifconfig eth0 192.168.0.2 netmask 255.255.255.0 up")
+    run = console1.runCmd("ifconfig eth0 172.30.206.1 netmask 255.255.255.0 up")
+    run = console2.runCmd("ifconfig eth0 172.30.206.2 netmask 255.255.255.0 up")
 except ConsoleError, e:
     saveLog(console.getHistory())
     FAIL(str(e))
 
 # Now ping...
 try:
-    run = console1.runCmd("ping -c 4 192.168.0.2")
+    run = console1.runCmd("ping -c 4 172.30.206.2")
     if run['return'] > 0:
         FAIL("Could not ping other host")
-    run = console2.runCmd("ping -c 4 192.168.0.1")
+    run = console2.runCmd("ping -c 4 172.30.206.1")
     if run['return'] > 0:
         FAIL("Could not pint other host")
 except ConsoleError, e: