0% found this document useful (0 votes)
59 views13 pages

Linux Networking

This document discusses various topics related to configuring networking on Linux systems. It covers determining the IP address of the Ethernet interface using ifconfig, temporarily and permanently changing the IP address, activating and deactivating interfaces with ifup and ifdown, viewing the routing table with netstat -nr, temporarily and permanently assigning the default gateway, deleting routes, configuring the system as a DNS client, and configuring the /etc/hosts and /etc/resolv.conf files. The document is a guide for Linux networking configuration provided by an instructor.

Uploaded by

sowaths
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views13 pages

Linux Networking

This document discusses various topics related to configuring networking on Linux systems. It covers determining the IP address of the Ethernet interface using ifconfig, temporarily and permanently changing the IP address, activating and deactivating interfaces with ifup and ifdown, viewing the routing table with netstat -nr, temporarily and permanently assigning the default gateway, deleting routes, configuring the system as a DNS client, and configuring the /etc/hosts and /etc/resolv.conf files. The document is a guide for Linux networking configuration provided by an instructor.

Uploaded by

sowaths
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Linux Networking

Mr. Chea Samnang


Linux Lecturer
How to Configure IP Address

• Determining Your IP Address


Most modern PCs come with an Ethernet
port. When Linux is installed, this device
is called eth0. You can determine the IP
address of this device with the ifconfig
command.
# ifconfig -a
How to Configure IP Address

• Changing Your IP Address (temporary)

• If you wanted, you could give this eth0


interface an IP address using the ifconfig
command.
# ifconfig eth0 10.0.0.1 netmask 255.255.255.0 up
How to Configure IP Address

• Changing Your IP Address (permanent)


• interface configuration files located in the
/etc/sysconfig/network-scripts directory.
#vi /etc/sysconfig/network-scripts/ifcfg-eth0
How to Configure IP Address

• How to Activate/Shut Down NIC

• The ifup and ifdown commands can be


used respectively to activate and
deactivate a NIC interface.
#ifdown eth0
#ifup eth0
Current Routing Table

• How to View Current Routing Table

The netstat -nr command will provide the

contents of the touting table.

#netstat -nr
Change Default Gateway

• How to assign Temporary Default


Gateway

• You can change temporarily change your


default gateway till the next reboot using
a simple command.

# route add default gw 192.168.15.1 eth0


Change Default Gateway

• How to assign Permanent Default


Gateway
Once done, you'll need to update your
/etc/sysconfig/network file to reflect the
change. This file is used to configure
your default gateway each time Linux
boots.
Change Default Gateway

• How to Delete a Route


You can delete your temporary default
gateway using a route command.
# route del default gw 192.168.15.1 eth0
Delete your permanent default gateway
by edit /etc/sysconfig/network
DNS Client

• Configuring Server as a DNS Client


/etc/hosts

• Configuring /etc/hosts File


The /etc/hosts file is just a list of IP
addresses and their corresponding
server names. Your server will typically
check this file before referencing DNS.

ip-address server-name alias-name

192.168.15.1 lawfirm.com www.lawfirm.com


/etc/resolv.conf

• The file that records DNS servers in all


Linux distributions is /etc/resolv.conf.
The End

You might also like