Friday, August 30, 2013

Basic configuraton --- Linux networking

Linux Box booted up, but no networking. Frustrated......
First check the following tools:

bash-3.2# ls /sbin/arp
/sbin/arp
bash-3.2# ls /sbin/ifconfig
/sbin/ifconfig
bash-3.2# ls /sbin/route
/sbin/route

What's the output:
bash-3.2# ifconfig
lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.255.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

bash-3.2# arp -a
bash-3.2# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
bash-3.2#
Nothing useful...........; Try the following commands:

bash-3.2# ifconfig eth0 192.168.70.245 netmask 255.255.248.0 up
bash-3.2# route add default gw 192.168.64.1
bash-3.2# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:A0:C9:00:00:02
          inet addr:192.168.70.245  Bcast:192.168.71.255  Mask:255.255.248.0
          inet6 addr: fe80::2a0:c9ff:fe00:2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:390 (390.0 b)

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

bash-3.2# ping 192.168.66.157
PING 192.168.66.157 (192.168.66.157) 56(84) bytes of data.
64 bytes from 192.168.66.157: icmp_seq=1 ttl=64 time=10.1 ms
64 bytes from 192.168.66.157: icmp_seq=2 ttl=64 time=0.292 ms
64 bytes from 192.168.66.157: icmp_seq=3 ttl=64 time=0.288 ms
64 bytes from 192.168.66.157: icmp_seq=4 ttl=64 time=0.287 ms
^C
--- 192.168.66.157 ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3008ms
rtt min/avg/max/mdev = 0.287/2.753/10.145/4.267 ms
bash-3.2# arp
Address                  HWtype  HWaddress           Flags Mask            Iface
192.168.66.157            ether   00:0e:1e:0b:18:c0   C                     eth0

bash-3.2# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.64.0     0.0.0.0         255.255.248.0   U     0      0        0 eth0
0.0.0.0         192.168.64.1     0.0.0.0         UG    0      0        0 eth0

bash-3.2# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:A0:C9:00:00:02
          inet addr:192.168.70.245  Bcast:192.168.71.255  Mask:255.255.248.0
          inet6 addr: fe80::2a0:c9ff:fe00:2/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1044 errors:0 dropped:0 overruns:0 frame:0
          TX packets:11 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:141103 (137.7 KiB)  TX bytes:866 (866.0 b)

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.255.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:4 errors:0 dropped:0 overruns:0 frame:0
          TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:344 (344.0 b)  TX bytes:344 (344.0 b)

So packet is flowing now.
Commands for reference:
  1. ifconfig
  2. route
  3. arp
  4. ping

No comments:

Post a Comment