| Start | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Interface details Ifconfig List all the interfaces available on the machine
List the details of a specific interface Syntax: Example: Ethtool - query the network driver and hardware settings Syntax: Example: ip - show / manipulate routing, devices, policy routing and tunnels Syntax: Examples List network interfaces Rename interface eth0 to wan Bring interface eth0 up (or down) List addresses for interfaces Add (or del) ip and mask (255.255.255.0) |
||||||||||||||||||||||||
| Adding IP to an interface An IP address to an interface could be obtained via DHCP or Static assignment DHCP
If you are connected to a network with a DHCP server running,
or alternatively, you could make a change to the Static configuration(Permanent Change) using If you want to statically configure the interface settings(permanent change), you could do so in the Example: These changes persist even after system reboot. Static configuration(Temporary change) using A static IP address could be added to an interface using the
Example:
|
||||||||||||||||||||||||
| Local DNS resolution File: Sample contents of the file: |
||||||||||||||||||||||||
| Configure DNS servers for domain name resolution File: Sample contents of the file: In case internal DNS server you can validate if this server resolve DNS names properly using |
||||||||||||||||||||||||
See and manipulate routes Manipulate the IP routing table using |
| Option | Description |
|---|---|
add or del | Add or delete a route |
-host x.x.x.x | Add route to a single host identified by the IP address |
-net x.x.x.x | Add route to a network identified by the network address |
gw x.x.x.x | Specify the network gateway |
netmask x.x.x.x | Specify the network netmask |
default | Add a default route |
Examples:
$ route add -host x.x.x.x eth1$ route add -net 2.2.2.0 netmask 255.255.255.0 eth0route add -net 2.2.2.0/24 eth0$ route add default gw 2.2.2.1 eth0$ route del -net 2.2.2.0/24ipDisplay routing table
$ ip route show # List routing table
Add/Delete route
| Option | Description |
|---|---|
add or del or change or append or replace | Change a route |
show or flush | the command displays the contents of the routing tables or remove it |
restore | restore routing table information from stdin |
get | this command gets a single route to a destination and prints its contents exactly as the kernel sees it |
Examples:
$ ip route add default via 1.2.3.254$ ip route add default via 192.168.1.1 dev eth0You can configure your Linux (or macOS) system in order to tie in an identifier <hostname> to some other system's IP address in your network. You can configure it:
For instance, you could add this line using the cat (opens new window) Unix tool. Suppose that you want to make a ping to a PC in yout local network whose IP address is 192.168.1.44 and you want to refer to that IP address just by remote_pc. Then you must write on your shell:
$ sudo cat 192.168.1.44 remote_pc
Then you can make that ping just by:
$ ping remote_pc
Read Article
https://develop.horje.com/learn/1434/reference