Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Thursday, 31 October 2013

Networking in linux


To start network services:
# /etc/rc.d/init.d/network start

To stop network services:
# /etc/rc.d/init.d/network stop

To restart network services:
# /etc/rc.d/init.d/network restart

To view the network configuraiton:
# ifconfig [or]
# ip addr show

To configure an interface :
# ifconfig eth0 192.168.0.1 netmask 255.255.255.0 up
# Modify the file /etc/sysconfig/network-scripts/ifcfg-eth0

To configure alias on eth0 :
# ifconfig eth0:1 192.168.0.2 netmask 255.255.255.0 up

To list routing table :
# route

To add the default gateway to the routing table:
# route add default gw 192.168.0.15
[or]
# ip route add default via 192.168.0.5

To add a route for a specific host:
# route add -host 11.0.0.2 gw 192.168.0.115

To add a route for a specific network:
# route add -net 11.0.0.0 gw 192.168.0.115

Daemon used for dynamin routing/ Uses RIP: routed

Command to start routed daemon:
# rcrouted start

Configure a network card:
# ip link set mtu 9000 dev eth0

To show the network links:
# ip link show

To view ARP cache:
# arp -n

To remove an ARP entry:
# arp -d 192.168.1.1

To modifiy the host name resolution order, Modify the below file:
# cat /etc/host.conf
order hosts,bind

To modify the DNS server info:
# cat /etc/resolv.conf
search openna.com
nameserver 218.104.16.6
nameserver 218.104.16.12

To configure networking in Linux, modify the below file:
# cat /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=yes
HOSTNAME=myserver
GATEWAY=192.168.1.1
GATEWAYDEV=eth0

To enable IP Forwarding:

For RHEL 6.2,
a. Add the below lines to /etc/sysctl.conf file
# Enable packet forwarding
net.ipv4.ip_forward = 1

b. Restart network services
# /etc/rc.d/init.d/network restart

For RHEL version lesser than 6.2,
a. Modify /etc/sysconfig/network
b. Restart network services

No comments:

Post a Comment