Csl /RunningTwoSubnetsWithDnsmasq

Bracton configures lab machines to have a particular IP address, depending on their mac address. The tool to do this is dnsmasq, and it is widely available for download.

My problem is that the c2wt project demo requires 10.0.0.* IP addresses (unfortunately, these are hard-coded in the Java sources (!?)), and the lab network is currently 192.168.1.* addresses.

First, I examine the current network configuration:

 sprinkjm@bracton:/etc/sysconfig/networking/devices$ /sbin/ifconfig
 eth2      Link encap:Ethernet  HWaddr 00:15:17:54:EE:88  
           inet addr:192.168.1.1  Bcast:192.168.1.255  Mask:255.255.255.0
           inet6 addr: fe80::215:17ff:fe54:ee88/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:8980524 errors:0 dropped:0 overruns:0 frame:0
           TX packets:18750282 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:1425544670 (1.3 GiB)  TX bytes:2207030456 (2.0 GiB)
           Base address:0xcf00 Memory:fcde0000-fce00000 

 eth3      Link encap:Ethernet  HWaddr 00:15:17:54:EE:89  
           inet addr:150.135.217.192  Bcast:150.135.219.255  Mask:255.255.252.0
           inet6 addr: fe80::215:17ff:fe54:ee89/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:441651898 errors:0 dropped:0 overruns:0 frame:0
           TX packets:173970189 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000 
           RX bytes:1201670564 (1.1 GiB)  TX bytes:3903417867 (3.6 GiB)
           Base address:0xce80 Memory:fcd80000-fcda0000 

 lo        Link encap:Local Loopback  
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436  Metric:1
           RX packets:244191 errors:0 dropped:0 overruns:0 frame:0
           TX packets:244191 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0 
           RX bytes:417984726 (398.6 MiB)  TX bytes:417984726 (398.6 MiB)

So, luckily, bracton has a few extra network ports. I look at the network config for the internal network:

/etc/sysconfig/networking/devices/ifcfg-eth2
# Intel Corporation 82571EB Gigabit Ethernet Controller
DEVICE=eth2
HWADDR=00:15:17:54:EE:88
BOOTPROTO=static
DHCPCLASS=
IPADDR=192.168.1.1
IPV6INIT=no
IPV6_AUTOCONF=no
NETMASK=255.255.255.0
ONBOOT=yes

I now use this as a model, to configure one of the network ports to have a 10.0.0.255 address, like so:

/etc/sysconfig/networking/devices/ifcfg-eth2
# Intel Corporation 80003ES2LAN Gigabit Ethernet Controller (Copper)
DEVICE=eth1
HWADDR=00:A0:D1:E6:E3:6F
BOOTPROTO=static
DHCPCLASS=
IPADDR=10.0.0.255
IPV6INIT=no
IPV6_AUTOCONF=no
NETMASK=255.0.0.0
ONBOOT=yes

Ok, now, DON'T RESTART THE NETWORK FROM THE SSH PROMPT! Fedora gets unhappy if you restart network over ssh. So, you have no choice except to restart from the machine's console (at least not one that I know of).

From the console of the machine (not over ssh!!)

 sudo /etc/init.d/network restart

Any ssh sessions you have will have died, here, so reconnect. Also, don't forget to plug your network port into the switch, as appropriate.

Now, we make a few edits in /etc/dnsmasq.conf, namely:

OK, so we can see that the actual dnsmasq.conf looks as below:

/etc/dnsmasq.conf
...
# If you want dnsmasq to listen for DHCP and DNS requests only on
# specified interfaces (and the loopback) give the name of the
# interface (eg eth0) here.
# Repeat the line for more than one interface.
interface=eth1
interface=eth2
interface=lo
...
# Uncomment this to enable the integrated DHCP server, you need
# to supply the range of addresses available for lease and optionally
# a lease time. If you have more than one network, you will need to
# repeat this for each network on which you want to supply DHCP
# service.
dhcp-range=192.168.1.200,192.168.1.250,12h
dhcp-range=10.0.0.0,10.0.0.50,12h
#dhcp-range=192.168.1.2,192.168.1.150,255.255.255.255,12h
...
# ironwood (qnx)
dhcp-host=00:1B:FC:FC:18:4C,10.0.0.6,ironwood
#dhcp-host=00:1B:FC:FC:18:4C,192.168.1.5,ironwood
# ironwood's other mac address
#dhcp-host=00:1B:21:10:67:65,192.168.1.5,ironwood
# ironwood (Kubuntu)
# dhcp-host=,192.168.1.5,ironwood
...
#192.168.1.9 frost
dhcp-host=00:1E:4F:D7:F9:46,10.0.0.7,frost
#dhcp-host=00:1E:4F:D7:F9:46,192.168.1.9,frost
...

Now, a dnsmasq restart

 sudo /etc/init.d/dnsmasq restart

And renewing the IP address will get you going.