Download presentation
Presentation is loading. Please wait.
Published byHugh McLaughlin Modified over 9 years ago
1
Linux network troubleshooting If your network connection is not working..
2
Quick troubleshoot Check that network cable is connected and one of NIC’s leds is lit. Also check that computer is powered on! If possible go to switch/hub where your machine is connected and check that connection led is lit. Is network leds seem to be ok, restart network with following command: service network restart (works with CentOS, fedora core and redhat) /etc/init.d/network restart (should work with other distributions also) Check what ifconfig tells you. If you’re not root user, you can check ifconfig with following command: /sbin/ifconfig
3
Connection and ip-address seems to be ok. Interface has received and sent some packages. [root@firewall ~]# /sbin/ifconfig eth0 Link encap:Ethernet HWaddr 00:10:5A:39:AC:1D inet addr:172.240.1.20 Bcast:172.240.1.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:7314123 errors:7 dropped:0 overruns:0 frame:7 TX packets:1894956 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:52529182 (50.0 MiB) TX bytes:234026392 (223.1 MiB) Interrupt:11 Base address:0xd000
4
If your ip-address isn’t shown, you most probably have DHCP enabled and DHCP-server is not giving you any address. If you don’t get ip-address Linux might interface disabled. You can use dhclient command manually to restart dhcp search. [root@firewall ~]# ifconfig eth0 Link encap:Ethernet HWaddr 00:10:5A:39:AC:1D UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:14 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 MiB) TX bytes:0 (0.1 MiB) Interrupt:11 Base address:0xd000
5
[root@firewall ~]# /sbin/route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.7.0 0.0.0.0 255.255.255.0 U 0 0 0 eth1 172.24.16.0 0.0.0.0 255.255.252.0 U 0 0 0 eth0 169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth1 0.0.0.0 172.24.16.1 0.0.0.0 UG 0 0 0 eth0 Check that default GW exists! If you have two network adapters check that there’s only one default GATEWAY!
6
CentOS network configuration files Are located in /etc/sysconfig –folder [root@firewall ~]# more /etc/sysconfig/network NETWORKING=yes HOSTNAME=firewall.datacom.intra.fi GATEWAY=172.24.16.1 The default GATEWAY can be set in network file or ifcfg-ethX file. It’s easier to troubleshoot if you have gateway set in one file only. If you have two network adapters check that there’s only one default GATEWAY!
7
CentOS Interface configuration file (static) [root@firewall ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=static ONBOOT=yes TYPE=Ethernet HWADDR=00:50:8B:5D:EE:1A IPADDR=172.24.16.240 NETMASK=255.255.252.0 NETWORK=172.24.16.0 BROADCAST=172.24.19.255 Static configuration for interface eth0. You must define at least IPADDR and NETMASK. If you have other than basic class C network specify also BROADCAST and NETWORK addresses. Remember to change BOOTPROTO to static if you’re setting static address manually!
8
CentOS Interface configuration file (dynamic) [root@firewall ~]# more /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE=eth0 BOOTPROTO=dhcp HWADDR=00:50:8B:5D:EE:1A ONBOOT=yes TYPE=Ethernet Dhcp gets all addresses automatically, only thing you need to set is BOOTPROTO. If your network still doesn’t work, you can add network configuration manually with following commands: ifconfig eth0 192.168.7.220 netmask 255.255.255.0 broadcast 192.168.7.255 route add default gw 192.168.7.1
9
Ubuntu & Debian Interface configuration file (static) Are located in /etc/network –folder. Most of the sites in internet are missing line auto eth0, which makes your system not to refetch interface addresses from the file. root@ubuntuserver:/home/test1# more /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The primary network interface auto eth0 iface eth0 inet static address 172.24.16.240 netmask 255.255.252.0 gateway 172.24.16.1
10
Ubuntu & Debian Interface configuration file (dynamic) Are located in /etc/network –folder root@ubuntuserver:/home/test1# more /etc/network/interfaces # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). # The primary network interface auto eth0 iface eth0 inet dhcp
11
Quick DNS checkup Name servers for machine are defined in /etc/resolv.conf –file. [root@clump coursefiles]# more /etc/resolv.conf search dc.turkuamk.fi nameserver 193.166.135.5 nameserver 193.166.139.5 Easy way to check that name servers work: 1) ping www.lukusali.nic.funet.fi 2) ping 193.166.3.7 If both pings works, then name servers are working If only the last ping works, then you have some problems with your name server configuration If both pings fail, check ifconfig and default route
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.