Network Management And Debugging WeeSan Lee <weesan@cs.ucr.edu> http://www.cs.ucr.edu/~weesan/cs183/
Roadmap Interface Configuration Route Configuration Network Debugging
Network Topology The Internet 192.168.0.0/24 .2 Router VM Host VM .1 10.0.0.0/24
Interface Configuration (Host VM) We will need: IP Address 10.0.0.2 Netmask 255.255.255.0 Broadcast 10.0.0.255 Gateway 10.0.0.1 Usually 10.0.0.0 - network 10.0.0.255 - broadcast
Interface Configuration (Router VM) Use ifconfig command $ ifconfig eth1 10.0.0.1 netmask 255.255.255.0 $ ifconfig eth1 eth1 Link encap:Ethernet HWaddr 00:C0:F0:3C:43:82 inet addr:10.0.0.1 Bcast:10.0.0.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:659988 errors:1 dropped:0 overruns:0 frame:0 TX packets:1016790 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:73459942 (70.0 Mb) TX bytes:1201693614 (1146.0 Mb) Interrupt:10 Base address:0xd880 To bring the interface eth1 down or up via ifconfig command $ ifconfig eth1 down $ ifconfig eth1 up
Interface Configuration (Router VM) Edit /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 ONBOOT=yes #BOOTPROTO=dhcp IPADDR=10.0.0.1 NETMASK=255.255.255.0 BROADCAST=10.0.0.255 To bring up the interface eth1 via ifup script $ ifup eth1 To bring down the interface eth1 via ifdown script $ ifdown eth1
IP Aliasing A way to assign multiple IP addresses on the same interface $ ifconfig eth1:0 10.0.0.3 netmask 255.255.255.0 $ ifconfig eth1:1 10.0.0.4 netmask 255.255.255.0 Why? We could experiment new services w/out new HW We could replace problematic HW with IP aliasing on a healthy machine temporary
Route Configuration (Router VM) Default routes Usually added by route command $ route add default gw 192.168.0.1 To remove a default route $ route del default gw 192.168.0.1 To make it persistent, edit /etc/sysconfig/network NETWORKING=yes HOSTNAME=host1 DOMAINNAME=weesan.com GATEWAY=192.168.0.1
Route Configuration (Router VM) $ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
Route Configuration (Router VM) Static routes Usually added by ifconfig command $ route add -net 10.0.0.0 netmask 255.255.255.0 eth1 $ route del -net 10.0.0.0 netmask 255.255.255.0 eth1 Edit /etc/sysconfig/static-routes eth1 net 10.0.0.0 netmask 255.255.255.0
Route Configuration (Router VM) $ netstat -rn Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
Enable IP Forwarding (Router VM) $ echo "1" > /proc/sys/net/ipv4/ip_forward To make it persistent, edit /etc/sysctl.conf Change net.ipv4.ip_forward to 1
Network Debugging Can be tricky Start from one component and work your way through Recommend procedures (bottom-up) Always check power first Check the LED on the devices Check connectivity, use tools like ping, traceroute, tcpdump, etc Verify application protocol, use telnet
ping Send ICMP-REQUEST and expect ICMP-REPLY $ ping 10.0.0.1 PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data. 64 bytes from 10.0.0.1: icmp_seq=1 ttl=64 time=1.18 ms 64 bytes from 10.0.0.1: icmp_seq=2 ttl=64 time=1.57 ms 64 bytes from 10.0.0.1: icmp_seq=3 ttl=64 time=1.03 ms --- 10.0.0.1 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 1.036/1.263/1.572/0.228 ms
ping Start from known next hop Not always works for remote hosts For example, eon.cs.ucr.edu drops ICMP packets
traceroute Send UDP packets to remote host with TTL 1, 2, 3, … $ weesan@delta-1:~> traceroute www.google.com traceroute: Warning: www.google.com has multiple addresses; using 72.14.253.99 traceroute to www.l.google.com (72.14.253.99), 30 hops max, 38 byte packets 1 138.23.211.1 (138.23.211.1) 0.286 ms 0.278 ms 0.353 ms 2 c6513telecom--te-9-4.ucr.edu (138.23.3.105) 25.070 ms 20.486 ms 1.064 ms 3 c6509telecom--te-3-3.ucr.edu (138.23.3.26) 0.384 ms 0.381 ms 0.361 ms 4 riv-dc1.riv-dc1--ucr.cenic.net (137.164.24.121) 0.311 ms 0.235 ms 0.225 ms 5 dc-lax-dc1--riv-dc1-pos.cenic.net (137.164.22.228) 1.457 ms 1.459 ms 1.446 ms 6 * * * … 11 po-in-f99.google.com (72.14.253.99) 31.902 ms 30.762 ms 30.745 ms
tcpdump Originally written by Van Jacobson $ tcpdump $ tcpdump -i eth0 $ tcpdump host eon $ tcpdump src net 10.0.0.0/24 and dst port 80 $ tcpdump -vvv $ man tcpdump
Reference LAH Ch 12: TCP/IP Networking Ch 13: Routing Ch 19: Network Management And Debugging