Using script below and isc-dhcp-server can create a DHCP server. However, the DHCP server h1 will use the config file /etc/dhcp/dhcpd.conf, if I create multiple DHCP servers in one topology, these DHCP servers will use the same config file. What should I do with topology with multiple DHCP servers?
#!/usr/bin/python
# autor: Ramon dos Reis Fontes
# book: Wireless Network Emulation with Mininet-WiFi
# github: https://github.com/ramonfontes/mn-wifi-book-en
from mininet.log import setLogLevel, info
from mn_wifi.cli import CLI
from mn_wifi.net import Mininet_wifi
def topology():
net = Mininet_wifi()
info("*** Creating nodes\n")
net.addStation('sta1', mac='00:00:00:00:00:02', ip='0/0', position='30,60,0')
ap1 = net.addAccessPoint('ap1', ssid='new-ssid', mode='g', channel='1',
position='50,50,0', failMode='standalone')
h1 = net.addHost('h1', ip='192.168.11.1/24', inNamespace=False)
net.setPropagationModel(model="logDistance", exp=4.5)
info("*** Configuring wifi nodes\n")
net.configureWifiNodes()
info("*** Creating links\n")
net.addLink(ap1, h1)
net.plotGraph(max_x=100, max_y=100)
info("*** Starting network\n")
net.build()
ap1.start([])
h1.cmd("echo 1 > /proc/sys/net/ipv4/ip_forward")
info("*** Running CLI\n")
CLI(net)
info("*** Stopping network\n")
net.stop()
if __name__ == '__main__':
setLogLevel('info')
topology()
Terminal:
sudo apt install isc-dhcp-server
vim /etc/dhcp/dhcpd.conf
option domain-name-servers 192.168.11.1;
subnet 192.168.11.0 netmask 255.255.255.0 {
range 192.168.11.2 192.168.11.254;
option routers 192.168.11.1;
default-lease-time 6000;
max-lease-time 72000;
INTERFACES="h1-eth0";
}
sudo python dhcp.py
mininet-wifi> xterm sta1 h1
sta1# ip addr show
h1# service isc-dhcp-server restart
sta1# dhclient
sta1# ip addr show
Using script below and
isc-dhcp-server
can create a DHCP server. However, the DHCP serverh1
will use the config file/etc/dhcp/dhcpd.conf
, if I create multiple DHCP servers in one topology, these DHCP servers will use the same config file. What should I do with topology with multiple DHCP servers?Terminal:
‵‵