Add experiment 1 results
This commit is contained in:
@@ -0,0 +1,91 @@
|
|||||||
|
10:58:29.655251 12:07:f8:bf:6e:ff > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 12:07:f8:bf:6e:ff, length 300, xid 0xecb5a2e, Flags [none] (0x0000)
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Discover
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Parameter-Request Option 55, length 13:
|
||||||
|
Subnet-Mask, BR, Time-Zone, Default-Gateway
|
||||||
|
Domain-Name, Domain-Name-Server, Option 119, Hostname
|
||||||
|
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
|
||||||
|
NTP
|
||||||
|
10:58:29.655633 82:3b:16:e9:bb:17 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:30.662723 82:3b:16:e9:bb:17 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:31.687064 82:3b:16:e9:bb:17 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:32.214530 12:07:f8:bf:6e:ff > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 12:07:f8:bf:6e:ff, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Discover
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Parameter-Request Option 55, length 13:
|
||||||
|
Subnet-Mask, BR, Time-Zone, Default-Gateway
|
||||||
|
Domain-Name, Domain-Name-Server, Option 119, Hostname
|
||||||
|
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
|
||||||
|
NTP
|
||||||
|
10:58:32.670822 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 62: (tos 0x0, ttl 64, id 28856, offset 0, flags [DF], proto ICMP (1), length 48)
|
||||||
|
192.168.1.1 > 192.168.1.131: ICMP echo request, id 21591, seq 0, length 28
|
||||||
|
10:58:32.670897 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 342: (tos 0xc0, ttl 64, id 52736, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
192.168.1.1.67 > 192.168.1.131.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0xecb5a2e, Flags [none] (0x0000)
|
||||||
|
Your-IP 192.168.1.131
|
||||||
|
Server-IP 192.168.1.1
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Offer
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Lease-Time Option 51, length 4: 43200
|
||||||
|
RN Option 58, length 4: 21600
|
||||||
|
RB Option 59, length 4: 37800
|
||||||
|
Subnet-Mask Option 1, length 4: 255.255.255.0
|
||||||
|
BR Option 28, length 4: 192.168.1.255
|
||||||
|
Default-Gateway Option 3, length 4: 192.168.1.1
|
||||||
|
10:58:32.671193 12:07:f8:bf:6e:ff > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 12:07:f8:bf:6e:ff, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Request
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Requested-IP Option 50, length 4: 192.168.1.131
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Parameter-Request Option 55, length 13:
|
||||||
|
Subnet-Mask, BR, Time-Zone, Default-Gateway
|
||||||
|
Domain-Name, Domain-Name-Server, Option 119, Hostname
|
||||||
|
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
|
||||||
|
NTP
|
||||||
|
10:58:32.673025 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 342: (tos 0xc0, ttl 64, id 52738, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
192.168.1.1.67 > 192.168.1.131.68: [bad udp cksum 0x851a -> 0x5896!] BOOTP/DHCP, Reply, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Your-IP 192.168.1.131
|
||||||
|
Server-IP 192.168.1.1
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: ACK
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Lease-Time Option 51, length 4: 43200
|
||||||
|
RN Option 58, length 4: 21600
|
||||||
|
RB Option 59, length 4: 37800
|
||||||
|
Subnet-Mask Option 1, length 4: 255.255.255.0
|
||||||
|
BR Option 28, length 4: 192.168.1.255
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Default-Gateway Option 3, length 4: 192.168.1.1
|
||||||
|
10:58:32.678132 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 342: (tos 0xc0, ttl 64, id 52737, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
192.168.1.1.67 > 192.168.1.131.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Your-IP 192.168.1.131
|
||||||
|
Server-IP 192.168.1.1
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Offer
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Lease-Time Option 51, length 4: 43200
|
||||||
|
RN Option 58, length 4: 21600
|
||||||
|
RB Option 59, length 4: 37800
|
||||||
|
Subnet-Mask Option 1, length 4: 255.255.255.0
|
||||||
|
BR Option 28, length 4: 192.168.1.255
|
||||||
|
Default-Gateway Option 3, length 4: 192.168.1.1
|
||||||
|
10:58:37.831406 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:37.831440 12:07:f8:bf:6e:ff > 82:3b:16:e9:bb:17, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Reply 192.168.1.131 is-at 12:07:f8:bf:6e:ff, length 28
|
||||||
Binary file not shown.
@@ -0,0 +1,109 @@
|
|||||||
|
mininet@mininet-vm:~/Networks-II/exercise$ sudo python3 ../source/build_network.py topology.json
|
||||||
|
Generated: topology.generated.py
|
||||||
|
mininet> h1 rm -f /var/lib/dhcp/dhclient.leases
|
||||||
|
mininet> h1 rm -f /tmp/dhcp.pcap
|
||||||
|
mininet> h1 tcpdump -i h1-eth0 -n -w /tmp/dhcp.pcap &
|
||||||
|
mininet> h1 ps aux | grep tcpdump
|
||||||
|
tcpdump: listening on h1-eth0, link-type EN10MB (Ethernet), capture size 262144 bytes
|
||||||
|
tcpdump 4196 0.0 0.1 10904 5920 pts/2 S+ 10:57 0:00 tcpdump -i h1-eth0 -n -w /tmp/dhcp.pcap
|
||||||
|
root 4199 0.0 0.0 9368 2548 pts/2 S+ 10:58 0:00 grep tcpdump
|
||||||
|
mininet> h1 dhclient h1-eth0
|
||||||
|
mininet> h1 pkill -INT tcpdump
|
||||||
|
12 packets captured
|
||||||
|
12 packets received by filter
|
||||||
|
0 packets dropped by kernel
|
||||||
|
mininet> h1 tcpdump -n -e -vv -r /tmp/dhcp.pcap
|
||||||
|
reading from file /tmp/dhcp.pcap, link-type EN10MB (Ethernet)
|
||||||
|
10:58:29.655251 12:07:f8:bf:6e:ff > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 12:07:f8:bf:6e:ff, length 300, xid 0xecb5a2e, Flags [none] (0x0000)
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Discover
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Parameter-Request Option 55, length 13:
|
||||||
|
Subnet-Mask, BR, Time-Zone, Default-Gateway
|
||||||
|
Domain-Name, Domain-Name-Server, Option 119, Hostname
|
||||||
|
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
|
||||||
|
NTP
|
||||||
|
10:58:29.655633 82:3b:16:e9:bb:17 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:30.662723 82:3b:16:e9:bb:17 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:31.687064 82:3b:16:e9:bb:17 > ff:ff:ff:ff:ff:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:32.214530 12:07:f8:bf:6e:ff > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 12:07:f8:bf:6e:ff, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Discover
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Parameter-Request Option 55, length 13:
|
||||||
|
Subnet-Mask, BR, Time-Zone, Default-Gateway
|
||||||
|
Domain-Name, Domain-Name-Server, Option 119, Hostname
|
||||||
|
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
|
||||||
|
NTP
|
||||||
|
10:58:32.670822 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 62: (tos 0x0, ttl 64, id 28856, offset 0, flags [DF], proto ICMP (1), length 48)
|
||||||
|
192.168.1.1 > 192.168.1.131: ICMP echo request, id 21591, seq 0, length 28
|
||||||
|
10:58:32.670897 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 342: (tos 0xc0, ttl 64, id 52736, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
192.168.1.1.67 > 192.168.1.131.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0xecb5a2e, Flags [none] (0x0000)
|
||||||
|
Your-IP 192.168.1.131
|
||||||
|
Server-IP 192.168.1.1
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Offer
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Lease-Time Option 51, length 4: 43200
|
||||||
|
RN Option 58, length 4: 21600
|
||||||
|
RB Option 59, length 4: 37800
|
||||||
|
Subnet-Mask Option 1, length 4: 255.255.255.0
|
||||||
|
BR Option 28, length 4: 192.168.1.255
|
||||||
|
Default-Gateway Option 3, length 4: 192.168.1.1
|
||||||
|
10:58:32.671193 12:07:f8:bf:6e:ff > ff:ff:ff:ff:ff:ff, ethertype IPv4 (0x0800), length 342: (tos 0x10, ttl 128, id 0, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
0.0.0.0.68 > 255.255.255.255.67: [udp sum ok] BOOTP/DHCP, Request from 12:07:f8:bf:6e:ff, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Request
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Requested-IP Option 50, length 4: 192.168.1.131
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Parameter-Request Option 55, length 13:
|
||||||
|
Subnet-Mask, BR, Time-Zone, Default-Gateway
|
||||||
|
Domain-Name, Domain-Name-Server, Option 119, Hostname
|
||||||
|
Netbios-Name-Server, Netbios-Scope, MTU, Classless-Static-Route
|
||||||
|
NTP
|
||||||
|
10:58:32.673025 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 342: (tos 0xc0, ttl 64, id 52738, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
192.168.1.1.67 > 192.168.1.131.68: [bad udp cksum 0x851a -> 0x5896!] BOOTP/DHCP, Reply, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Your-IP 192.168.1.131
|
||||||
|
Server-IP 192.168.1.1
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: ACK
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Lease-Time Option 51, length 4: 43200
|
||||||
|
RN Option 58, length 4: 21600
|
||||||
|
RB Option 59, length 4: 37800
|
||||||
|
Subnet-Mask Option 1, length 4: 255.255.255.0
|
||||||
|
BR Option 28, length 4: 192.168.1.255
|
||||||
|
Hostname Option 12, length 10: "mininet-vm"
|
||||||
|
Default-Gateway Option 3, length 4: 192.168.1.1
|
||||||
|
10:58:32.678132 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype IPv4 (0x0800), length 342: (tos 0xc0, ttl 64, id 52737, offset 0, flags [none], proto UDP (17), length 328)
|
||||||
|
192.168.1.1.67 > 192.168.1.131.68: [udp sum ok] BOOTP/DHCP, Reply, length 300, xid 0xecb5a2e, secs 3, Flags [none] (0x0000)
|
||||||
|
Your-IP 192.168.1.131
|
||||||
|
Server-IP 192.168.1.1
|
||||||
|
Client-Ethernet-Address 12:07:f8:bf:6e:ff
|
||||||
|
Vendor-rfc1048 Extensions
|
||||||
|
Magic Cookie 0x63825363
|
||||||
|
DHCP-Message Option 53, length 1: Offer
|
||||||
|
Server-ID Option 54, length 4: 192.168.1.1
|
||||||
|
Lease-Time Option 51, length 4: 43200
|
||||||
|
RN Option 58, length 4: 21600
|
||||||
|
RB Option 59, length 4: 37800
|
||||||
|
Subnet-Mask Option 1, length 4: 255.255.255.0
|
||||||
|
BR Option 28, length 4: 192.168.1.255
|
||||||
|
Default-Gateway Option 3, length 4: 192.168.1.1
|
||||||
|
10:58:37.831406 82:3b:16:e9:bb:17 > 12:07:f8:bf:6e:ff, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Request who-has 192.168.1.131 tell 192.168.1.1, length 28
|
||||||
|
10:58:37.831440 12:07:f8:bf:6e:ff > 82:3b:16:e9:bb:17, ethertype ARP (0x0806), length 42: Ethernet (len 6), IPv4 (len 4), Reply 192.168.1.131 is-at 12:07:f8:bf:6e:ff, length 28
|
||||||
|
mininet> exit
|
||||||
|
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
"""Generated Mininet topology. Do not edit by hand."""
|
||||||
|
|
||||||
|
import shlex
|
||||||
|
|
||||||
|
from mininet.cli import CLI
|
||||||
|
from mininet.link import TCLink
|
||||||
|
from mininet.net import Mininet
|
||||||
|
|
||||||
|
|
||||||
|
def _shell_join(args):
|
||||||
|
"""Quote command arguments for execution inside a Mininet node."""
|
||||||
|
|
||||||
|
return ' '.join(shlex.quote(str(arg)) for arg in args)
|
||||||
|
|
||||||
|
|
||||||
|
def _node_cmd(node, *args):
|
||||||
|
"""Execute one safely quoted command inside a Mininet node."""
|
||||||
|
|
||||||
|
return node.cmd(_shell_join(args))
|
||||||
|
|
||||||
|
|
||||||
|
def _start_background(node, args, log_path):
|
||||||
|
"""Start one background process and return its shell PID."""
|
||||||
|
|
||||||
|
command = _shell_join(args)
|
||||||
|
shell_command = (
|
||||||
|
command
|
||||||
|
+ ' >'
|
||||||
|
+ shlex.quote(log_path)
|
||||||
|
+ ' 2>&1 & echo $!'
|
||||||
|
)
|
||||||
|
return node.cmd('sh -c ' + shlex.quote(shell_command)).strip()
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
"""Build, configure, expose, and clean up the planned network."""
|
||||||
|
|
||||||
|
net = Mininet(controller=None, build=False)
|
||||||
|
nodes = {}
|
||||||
|
service_processes = []
|
||||||
|
|
||||||
|
try:
|
||||||
|
# Create nodes.
|
||||||
|
nodes['h1'] = net.addHost('h1', ip=None)
|
||||||
|
nodes['h2'] = net.addHost('h2', ip=None)
|
||||||
|
nodes['h3'] = net.addHost('h3', ip=None)
|
||||||
|
nodes['s1'] = net.addSwitch('s1', failMode='standalone')
|
||||||
|
nodes['s2'] = net.addSwitch('s2', failMode='standalone')
|
||||||
|
nodes['r0'] = net.addHost('r0', ip=None)
|
||||||
|
|
||||||
|
# Create links.
|
||||||
|
net.addLink(
|
||||||
|
nodes['h1'],
|
||||||
|
nodes['s1'],
|
||||||
|
intfName1='h1-eth0',
|
||||||
|
intfName2='s1-eth0',
|
||||||
|
)
|
||||||
|
net.addLink(
|
||||||
|
nodes['h2'],
|
||||||
|
nodes['s1'],
|
||||||
|
intfName1='h2-eth0',
|
||||||
|
intfName2='s1-eth1',
|
||||||
|
)
|
||||||
|
net.addLink(
|
||||||
|
nodes['h3'],
|
||||||
|
nodes['s2'],
|
||||||
|
intfName1='h3-eth0',
|
||||||
|
intfName2='s2-eth0',
|
||||||
|
)
|
||||||
|
net.addLink(
|
||||||
|
nodes['r0'],
|
||||||
|
nodes['s1'],
|
||||||
|
intfName1='r0-eth0',
|
||||||
|
intfName2='s1-eth2',
|
||||||
|
)
|
||||||
|
net.addLink(
|
||||||
|
nodes['r0'],
|
||||||
|
nodes['s2'],
|
||||||
|
intfName1='r0-eth1',
|
||||||
|
intfName2='s2-eth1',
|
||||||
|
)
|
||||||
|
|
||||||
|
# Materialize the Mininet topology.
|
||||||
|
net.build()
|
||||||
|
net.start()
|
||||||
|
|
||||||
|
# Configure concrete interfaces.
|
||||||
|
_node_cmd(nodes['h1'], 'ip', '-4', 'addr', 'flush', 'dev', 'h1-eth0')
|
||||||
|
_node_cmd(nodes['h1'], 'ip', 'link', 'set', 'dev', 'h1-eth0', 'up')
|
||||||
|
_node_cmd(nodes['h2'], 'ip', '-4', 'addr', 'flush', 'dev', 'h2-eth0')
|
||||||
|
_node_cmd(nodes['h2'], 'ip', 'link', 'set', 'dev', 'h2-eth0', 'up')
|
||||||
|
_node_cmd(nodes['h3'], 'ip', '-4', 'addr', 'flush', 'dev', 'h3-eth0')
|
||||||
|
_node_cmd(nodes['h3'], 'ip', 'addr', 'add', '192.168.2.10/24', 'dev', 'h3-eth0')
|
||||||
|
_node_cmd(nodes['h3'], 'ip', 'link', 'set', 'dev', 'h3-eth0', 'up')
|
||||||
|
_node_cmd(nodes['r0'], 'ip', '-4', 'addr', 'flush', 'dev', 'r0-eth0')
|
||||||
|
_node_cmd(nodes['r0'], 'ip', 'addr', 'add', '192.168.1.1/24', 'dev', 'r0-eth0')
|
||||||
|
_node_cmd(nodes['r0'], 'ip', 'link', 'set', 'dev', 'r0-eth0', 'up')
|
||||||
|
_node_cmd(nodes['r0'], 'ip', '-4', 'addr', 'flush', 'dev', 'r0-eth1')
|
||||||
|
_node_cmd(nodes['r0'], 'ip', 'addr', 'add', '192.168.2.1/24', 'dev', 'r0-eth1')
|
||||||
|
_node_cmd(nodes['r0'], 'ip', 'link', 'set', 'dev', 'r0-eth1', 'up')
|
||||||
|
|
||||||
|
# Configure static default routes.
|
||||||
|
_node_cmd(nodes['h3'], 'ip', 'route', 'replace', 'default', 'via', '192.168.2.1', 'dev', 'h3-eth0')
|
||||||
|
|
||||||
|
# Apply node-level networking settings.
|
||||||
|
_node_cmd(nodes['r0'], 'sysctl', '-w', 'net.ipv4.ip_forward=1')
|
||||||
|
_node_cmd(nodes['r0'], 'sysctl', '-w', 'net.ipv4.conf.all.rp_filter=0')
|
||||||
|
_node_cmd(nodes['r0'], 'sysctl', '-w', 'net.ipv4.conf.default.rp_filter=0')
|
||||||
|
_node_cmd(nodes['r0'], 'sysctl', '-w', 'net.ipv4.conf.r0-eth0.rp_filter=0')
|
||||||
|
_node_cmd(nodes['r0'], 'sysctl', '-w', 'net.ipv4.conf.r0-eth1.rp_filter=0')
|
||||||
|
|
||||||
|
# Start planned services.
|
||||||
|
_node_cmd(nodes['r0'], 'rm', '-f', '/tmp/mininet-dnsmasq-0.leases', '/tmp/mininet-dnsmasq-0.pid')
|
||||||
|
pid = _start_background(
|
||||||
|
nodes['r0'],
|
||||||
|
['dnsmasq', '--no-daemon', '--conf-file=', '--port=0', '--bind-interfaces', '--dhcp-authoritative', '--interface=r0-eth0', '--dhcp-range=192.168.1.100,192.168.1.200,12h', '--dhcp-leasefile=/tmp/mininet-dnsmasq-0.leases', '--pid-file=/tmp/mininet-dnsmasq-0.pid', '--dhcp-option=3,192.168.1.1'],
|
||||||
|
'/tmp/mininet-dnsmasq-0.log',
|
||||||
|
)
|
||||||
|
service_processes.append((nodes['r0'], pid))
|
||||||
|
|
||||||
|
# DHCP clients are intentionally not started here.
|
||||||
|
# The assignment captures DHCP before dhclient is run manually.
|
||||||
|
CLI(net)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
# Stop only the service processes started by this script.
|
||||||
|
for node, pid in reversed(service_processes):
|
||||||
|
if pid:
|
||||||
|
_node_cmd(node, 'kill', pid)
|
||||||
|
|
||||||
|
net.stop()
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
main()
|
||||||
Reference in New Issue
Block a user