Tanti Technology

My photo
Bangalore, karnataka, India
Sandeep Kumar | Founder, Tanti Technologies At Tanti Technologies, I share practical knowledge, hands-on tutorials, and real-world solutions across Python, SQL, Docker, Kubernetes, CI/CD, AWS, Azure, Machine Learning, Generative AI, and Agentic AI. My mission is to simplify complex technologies and provide actionable insights that help developers, engineers, and businesses learn faster, build better, automate smarter, and innovate with confidence. 🚀 Learn • Build • Automate • Innovate Follow Tanti Technologies for practical technology insights and next-generation AI solutions.

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