Network Management and Debugging: Weesan Lee
Network Management and Debugging: Weesan Lee
Roadmap
Network Topology
The The Internet Internet
.1
.2 10.0.0.0/24
We will need:
Usually
IP Address
Netmask
Broadcast
Gateway
$ 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 $ ifconfig eth1 down $ ifconfig eth1 up
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 $ ifup eth1 $ ifdown eth1
IP Aliasing
$ ifconfig eth1:0 10.0.0.3 netmask 255.255.255.0 $ ifconfig eth1:1 10.0.0.4 netmask 255.255.255.0 We could experiment new services w/out new HW We could replace problematic HW with IP aliasing on a healthy machine temporary
Why?
$ route add default gw 192.168.0.1 $ route del default gw 192.168.0.1 NETWORKING=yes HOSTNAME=host1 DOMAINNAME=weesan.com GATEWAY=192.168.0.1
$ netstat -rn Kernel IP routing table Destination Gateway 192.168.0.0 0.0.0.0 169.254.0.0 0.0.0.0 0.0.0.0 192.168.0.1
$ 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 eth1 net 10.0.0.0 netmask 255.255.255.0
Edit /etc/sysconfig/static-routes
$ netstat -rn Kernel IP routing table Destination Gateway 10.0.0.0 0.0.0.0 192.168.0.0 0.0.0.0 169.254.0.0 0.0.0.0 0.0.0.0 192.168.0.1
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
traceroute
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