Ch4 Net Config - en
Ch4 Net Config - en
2021-2022 1
hostname
Defined hostname or display name of the current host system. A privileged user can define the hostname with the
hostname argument.
Exemple:
# hostname: give the name of the Linux system
# hostname PC1: to assign the name PC1 to the computer
Syntaxe
Hostname [option] [name of Host]
Options
-d, display the DNS domain name.
-f, Display the fully qualified domain name.
-i, Display the host's IP address (es).
2021-2022 2
Configuration Tools (ifconfig)
Exemple:
$ ifconfig eth0 192.168.3.45 netmask 255.255.255.0 up
The ip address 192.168.3.45 and the netmask 255.255.255.0 are added to the eth0 interface.
2021-2022 3
Configuration Tools (ifconfig)
If the parameters are not given, the interface and the configuration of this interface are given.
If the interface is not specified, it will list all the information available for the active interfaces
2021-2022 4
Configuration Tools (ifconfig)
• Activating Interfaces
$ ifconfig eth0 up
This command will activate the eth0 interface.
$ ifconfig eth0 down
This will close the eth0 interface.
The interface must be chosen so that the correct interface is enabled or disabled.
2021-2022 5
Configuration Files
2021-2022 6
Diagnostic Tools (ping)
• Purpose of ping
This program will help determine if a computer is online by sending
an ICMP ECHO_REQUEST. The expected response is in the form of
ICMP ECHO_RESPONSE. In other words, there should be a
response back from the machine that was contacted.
Syntax
$ ping [options] destination
• Example:
$ ping 192.168.4.35
2021-2022 7
Diagnostic Tools (ping)
• ping Options
-c count number of packets to send
-s size determines the size of the packets to be sent
-I Interface which network card to use
-i interval time interval
2021-2022 8
Diagnostic Tools (ping)
• Count Option
Example:
2021-2022 9
Diagnostic Tools (ping)
• Interface Option
Example:
$ ping -I eth1 192.168.4.35
The -I interface option allows the user to choose which network adapter to use. network interfaces start with eth0 and increase. eth1
is the second network interface.
Interval Option
Example:
$ ping -i .2 192.168.4.35
The -i option allows a time interval change. the default time interval is 1 second. This interval can be reduced to 0.2. After that, root
rights should be used to reduce it further.
The -i option allows a time interval change. the default time interval is 1 second. This interval may be dropped to. 2. After that root
rights must be used to decrease it further.
2021-2022 10
Diagnostic Tools (ping)
• Size Option
Example:
2021-2022 11
Diagnostic Tools (netstat)
netstat - The netstat command can be used to view the network's current status.
Options
-r display routing table
-i display interfaces
-s display statistics
-t can be used to list all active TCP connections.
Example:
$ netstat -r
This will display the routing table for your computer including: Destination, Gateway, Mask, Flags, and
Interface.
2021-2022 12
Diagnostic Tools (traceroute)
2021-2022 13
The loopback interface
• The loopback interface
–On most Linux distributions, the loopback interface is already configured. You can check
this by doing the following:
# /sbin/ifconfig lo
–If not configured, do the following:
# ifconfig lo 127.0.0.1
2021-2022 14
Dynamic IP
• Dhclient requet an IP@ from DHCP server
• dhclient eth0
• Option
• -r : release
2021-2022 15
host
Example:
$ host abc.com
This will return the following:
abc.com has address 204.202.136.19
abc.com has address 204.202.136.32
2021-2022 16
route
route - Set Routes
Purpose of route
The route tool can be used to view and manipulate the computer's internal routing table.
• When the add or del options are used, route modifies the routing tables.
• Without these options, route displays the current contents of the routing tables.
2021-2022 17
route
• route Options
-net target is a network
-host target is a single host
gw gateway
default this is the location of the default gateway
Example:
$ route add –host 192.168.2.1 gw 192.168.1.1
To reach 192.168.2.1, use 192.168.1.1 as a router
2021-2022 18
ftp
• ftp - file Transfer Protocol
This will allow you to connect to an ftp server to download or upload text or programs. When
you are finished type quit.
Example:
$ ftp 192.168.5.45
This will connect you to the ftp server at the IP address. You will need a username and
password.
$ ftp rpm.com
The same result but using a host name
2021-2022 19
telnet
Example:
$ telnet mysite.com
$ telnet 192.168.4.56
This will allow you to telnet to an IP address. Notice the
example is a private IP address.
2021-2022 20