Network config in Linux: PART 1 - Click Here
In This part 2 we are going to see the below points ,
5.Configuring IP address for interface?
6.How to define the routing ?
7.How to activate / deactivate network interfaces ?
8.How to enable IP Forward in Linux?
9.Speed and Duplex setting for interface?
10.Usefull commands in Linux for network troubleshoot.
5. Configuring IP address for interface:
A.Command Line using ifconfig //Temperary
# ifconfig eth0 XXX.XXX.XXX.XXX netmask 255.255.255.0 broadcast XXX.XXX.XXX.255
B.Manually assign IP in config file - /etc/sysconfig/network-scripts/ifcfg-ethX /permanent
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
For Alias IP
#vi /etc/sysconfig/network-scripts/ifcfg-eth0:0
C.Using GUI Tool - /usr/sbin/system-config-network
6. How to define / add routing ?
A. Through 'route' command
route add default gw XXX.XXX.XXX.XXX dev eth0
route add -net XXX.XXX.XXX.0 netmask 255.255.255.0 gw XXX.XXX.XXX.XXX dev eth0
B. Modify the config file - /etc/sysconfig/static-routes //only for static routes
C. Define the parameter in config file - /etc/sysconfig/network-scripts/ifcfg-ethX
7. Activate deactivate Network interfaces:
A. Activate:
# /sbin/ifup eth0 (or) #ifconfig eth0 up
B. De-Activate:
# /sbin/ifdown eth0 (or) #ifconfig eth0 down
8 .Enable IP forward:
A. Turn on IP forwarding to allow Linux computer to act as a gateway or router.
#echo 1 > /proc/sys/net/ipv4/ip_forward
B. Modify the config file entry - /etc/sysctl.conf
#vi /etc/sysctl.conf
net.ipv4.ip_forward = 1
C. Verify ip forward
#cat /proc/sys/net/ipv4/ip_forward
1
9. Speed and Duplex setting in Linux ?
A. Using the command : mii-tool // view, manipulate media-independent interface status
To view the speed - # mii-tool -v
To set the speed - #mii-tool -F option
#mii-tool -A option
B.Using the command : ethtool // Display or change ethernet card settings
ethtool -g eth0 Queries ethernet device for rx/tx ring parameter information.
ethtool -a eth0 Queries ethernet device for pause parameter information.
ethtool -c eth0 Queries ethernet device for coalescing information.
ethtool -i eth0 Queries ethernet device for associated driver information.
ethtool -d eth0 Prints a register dump for the specified ethernet device.
ethtool -k eth0 Queries ethernet device for offload information.
ethtool -S eth0 Queries ethernet device for NIC and driver statistics.
10. Usefull commands and files in Linux for netowrk troubleshoot:
1. /etc/rc.d/init.d/network start - command to start, restart or stop the network
2. /etc/inetd.conf - Network Socket Listener Daemons
- The network listening daemons listen and respond to all network socket connections made on the TCP/IP ports assigned to it. The ports are defined by the file /etc/services
- Entries in this file consist of a single line made up of the following fields:
service socket-type protocol wait user server cmdline
Note : The inetd daemon must be restarted to pick up the changes made to the file:
#/etc/rc.d/init.d/inetd restart
3.netstat - Display connections, routing tables, stats etc
List all connected processes: #netstat -nap
Show network statistics: #netstat -s
Display routing table info: #netstat -rn
Display interface statistics: #netstat -i
4.traceroute - print the route packets take to network host
5. socklist - Display list of open sockets, type, port, process id and the name of the process. Kill with fuser or kill
6. nslookup - Give a host name and the command will return IP address. Note that nslookup does not use the /etc/hosts file
7. Mii-tool - view, manipulate media-independent interface status
8. ethtool - Display or change ethernet card settings
9. tcpdump - Dump traffic on a network.
Network config in Linux: PART 1 - Click Here
1.Commands list hardwares in Linux?
2.How to List Network cards in Linux server?
3.Config Files for network in Linux?
4.Adding new network card on Linux server?
In part 1 - the above points discussed.
3 Comments
F7DBF308
ReplyDeleteIğdır
Hakkari
Uşak
Aydın
Sinop
Aksaray
Mardin
Elazığ
Ordu
0F47C86F
ReplyDeleteAkçakoca
Bayındır
Ortaköy
Akdeniz
Gökçeada
Çarşamba
Ilıca
Edremit
Bahçelievler
E8049276
ReplyDeleteSerdivan
Alpu
Kemalpaşa
Mut
Tatvan
Siverek
Marmaris
Balçova
Bandırma