network-troubleshooting & system management

Download Report

Transcript network-troubleshooting & system management

Network Configuration in RHEL5
Network Configuration

Module Management

List all pci devices


List all Modules


lsmod
Load Modules


lspci
modprobe or insmod
Remove Modules

rmmod
Network Configuration

Configuration at Command Prompt

Permanent set the address


System-config-network-tui
Temporary set the Address

Ifconfig eth0 192.168.1.110 netmask 255.255.128.0 up
Network Configuration

Configuration at Graphical Tool

Permanent set the address



System-config-network-gui
Neat
System menu --> Administrattion --> Network
Network Configuration

Dhcp server testing

Dhclient eth0
Network Configuration

Configuration file locations




/etc/sysconfig/network-scripts/ifcfg-eth0
/etc/sysconfig/network
/etc/hosts
/etc/resolv.conf
Network Configuration

Ping

ping 127.0.0.1

PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.061 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.028 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.018 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.024 ms







--- 127.0.0.1 ping statistics --4 packets transmitted, 4 received, 0% packet loss, time 3003ms
rtt min/avg/max/mdev = 0.018/0.032/0.061/0.018 ms
configure the network card



GUI tool (X Windows required) - system-confignetwork
Command line text based GUI tool (No X Windows
required) - system-config-network
Edit configuration files stored in
/etc/sysconfig/network-scripts/ directory.
GUI tool system-config-network
GUI tool system-config-network
Command line tool system-confignetwork-tui
Command line tool system-confignetwork-tui (2)
Edit configuration

# cd /etc/sysconfig/network-scripts/

# vi ifcfg-eth0

# Intel Corporation 82573E Gigabit Ethernet Controller (Copper)

DEVICE=eth0

BOOTPROTO=static

DHCPCLASS=

HWADDR=00:30:48:56:A6:2E

IPADDR=10.10.29.66

NETMASK=255.255.255.192

ONBOOT=yes
Edit configuration

# vi /etc/sysconfig/network

NETWORKING=yes

HOSTNAME=www1.nixcraft.in

GATEWAY=10.10.29.65

# /etc/init.d/network restart
Edit configuration

# vi /etc/resolv.conf

nameserver 10.0.80.11

nameserver 10.0.80.12

Nameserver 202.67.222.222

$ ping 10.0.80.12

$ nslookup cyberciti.biz
Network Configuration

ethtool
Network Configuration

Telnet
telnet 192.168.1.110 80
Trying 192.168.1.110...
Connected to 192.168.1.110.
Escape character is '^]'.

Then press ctr+] to quit from this, then type quit
Network Configuration

Nmap
nmap 192.168.1.110
Starting Nmap 4.53 ( http://insecure.org ) at 2008-12-14 08:29 IST
Interesting ports on 192.168.208.1:
Not shown: 1711 closed ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
111/tcp open rpcbind
Nmap done: 1 IP address (1 host up) scanned in 13.253 seconds
Network Configuration

Virtual ip

Temporary set the Address


ifconfig eth0:1 192.168.1.110 netmask 255.255.128.0 up
Permanent set the address



cd /etc/sysconfig/network-scripts/
cp ifcfg-eth0 ifcfg-eth0:1
vi ifcfg-eth0:1


Change device eth0 to eth0:1
Change ip address
Network Configuration

Gateway Settings

To see current gateway entry


To add new gateway


route del -net 192.56.76.0 netmask 255.255.255.0
To add default gateway


route add -net 192.56.76.0 netmask 255.255.255.0 dev eth0
To remove exist gateway


route -n
route add default gw mango-gw
To remove default gateway

route del default
Network Configuration

DNS Entries


Client config file is /etc/resolv.conf
Nameserver ip-address of dns server
Network Configuration

DNS troubleshooting

nslookup yahoo.com
root@laptop:~# nslookup yahoo.com
Server:
192.168.1.3
Address:
192.168.1.3#53
Non-authoritative answer:
Name:
yahoo.com
Address: 68.180.206.184
Name:
yahoo.com
Address: 206.190.60.37
root@laptop:~#
Network Configuration

mtr
Network Configuration

Traceroute


[root@sleipnir root]# traceroute www.pcuser.com.au
traceroute to www.pcuser.com.au (203.18.241.23), 30 hops max, 38 byte packets
1 dvalin (192.168.168.252) 0.705 ms 0.289 ms 0.391 ms
2 midgard.lesbell.com.au (203.97.202.158) 1.829 ms 1.553 ms 1.673 ms
3 Loopback1.ken10.Sydney.telstra.net (165.228.2.1) 18.125 ms 17.887 ms 19.615 ms
4 GigabitEthernet2-1.ken17.Sydney.telstra.net (203.50.20.27) 20.833 ms 20.587 ms
19.583 ms
5 austra426.lnk.telstra.net (139.130.238.198) 21.840 ms 21.336 ms 20.195 ms
6 ***
7 ***

[root@sleipnir root]#







Network Configuration

wireshark
Network Configuration

Arping
[root@server ~]# arping 192.168.208.1
ARPING 192.168.208.1 from 192.168.0.227 eth0
Unicast reply from 192.168.208.1 [00:16:D3:FB:5A:00] 1.374ms
Unicast reply from 192.168.208.1 [00:16:D3:FB:5A:00] 0.868ms
Sent 2 probes (1 broadcast(s))
Received 2 response(s)
[root@server ~]#
Network Configuration

Tcpdump

Capture only eth0


Capture only UDP packets


tcpdump udp
Capture only TCP packets


Tcpdump -i eth0
tcpdump tcp
Capture only UDP packets with source & destination
port 53 (DNS requests & replies)

tcpdump udp port 53

Understanding run-level scripts
System Startup and Shutdown
During system startup, a series of scripts are run to start
the services that you need. These include scripts to
start network interfaces, mount directories, and
monitor your system. Most of these scripts are run
from subdirectories of /etc/rc.d. The program that
starts most of these services up when you boot and
stops them when you shut down is the /etc/rc.d/rc
script. The following sections describe run-level
scripts and what you can do with them.
Starting run-level scripts
As previously mentioned, the /etc/rc.d/rc script is integral to the concept of run
levels. Any change of run level causes the script to be executed, with the new
run level as an argument. Here's a quick run-down of what the /etc/rc.d/rc
script does:
* Checks that run-level scripts are correct -- Therc script checks to find each
run-level script that exists and excludes those that represent backup scripts
left by rpm updates.
* Determines current and previous run levels -- Determines the current and
previous run levels to know which run-level scripts to stop (previous level)
and start (current level).
* Decides whether to enter interactive startup -- If the confirm option is
passed to the boot loader at boot time, all server processes must be confirmed
at the system console before starting.
* Kills and starts run-level scripts -- Stops run-level scripts from the previous
level, then starts run-level scripts from the current level.
Understanding run-level scripts
Each script representing a service that you want to start
or stop is linked to a file in each of the run-level
directories. For each run level, a script beginning
with K stops the service, whereas a script beginning
with S starts the service.
The two digits following the K or S in the filename
provide a mechanism to select the priority in which
the programs are run. For example, S12syslog is run
before S90crond. However, the file S110my_daemon
is run before S85gpm,
Configuring the Default RHEL
Runlevel

# Default runlevel. The runlevels used by RHS are:

# 0 - halt (Do NOT set initdefault to this)

# 1 - Single user mode

# 2 - Multiuser, without NFS (The same as 3, if you do not have networking)

# 3 - Full multiuser mode

# 4 - unused

# 5 - X11

# 6 - reboot (Do NOT set initdefault to this)

#

id:3:initdefault:
All of the programs within the /etc/rcX.d directories (where X is replaced by a
run-level number) are symbolic links, usually to a file in /etc/init.d. The
/etc/rcX.d directories include the following:
* /etc/rc0.d: Run level 0 directory
* /etc/rc1.d: Run level 1 directory
* /etc/rc2.d: Run level 2 directory
* /etc/rc3.d: Run level 3 directory
* /etc/rc4.d: Run level 4 directory
* /etc/rc5.d: Run level 5 directory
* /etc/rc6.d: Run level 6 directory
Service Not Required

Anacron

Atd

Bluetooth

Crond

Cups

Dhcpd

Dovecot

Firstboot

Haldaemon

Hplip

Netfs

Nfs

portmap
Service Not Required (2)

Routed

Sendmail

Smb

Spamassassin

Squid

Vsftpd

After saving the file and exiting the editor, you can reboot the machine or just run
any of the following three commands to begin using the new batch threshold value:

# service atd reload

# service atd restart

# service atd stop ; service atd start
Organised run-level scripts from the
GUI

# system-config-services

# chkconfig --list | less

# ntsysv

# chkconfig --add my_daemon

# chkconfig --list my_daemon

# runlevel