Basic Commands for Networking in Linux

IPV4 Address: 32-bit

192.168.2.34–

IPv6 address : 128 bit : 8 groups of 4 hex digits

3ffe:1900:fe21:4545:0000:0000:0000:0000—

IPV6 Format (From AI Tools/OpenAI/ChatGPT)

ifconfig command output: to know your network interface configurations.

ifconfig

Explain the output of the Linux Command (From AI Tools/OpenAI/ChatGPT/Interney)
ifconfig

instead of ifconfig you can use ip address show command

command: ip address show
Output as follows:

Explain the output of ip address show

Find device and link information using the ip command:  ip link show
The connection of a network interface to another device is called a link

Output of ip link show

To get Device statistics: ip -s link show

Output as follows:

Ip Address : Assign, See, and Delete

ip address add 192.168.2.22/24 brd + dev ens18

ip address show dev ens18

ip address del 192.168.2.22 dev ens18

ip link set eth0 up

ip link set eth0 down

SHOW Routing Table:

ip route show

ip route list dev ens18

Routing Commands: Modifications

ip route add <network/mask> via <gateway_IP>

ip route add 192.168.1.1/24 via 10.0.2.10

ip route add default via <gateway_IP>

ip route add default via 10.0.2.11

ip route add <NETWORK/MASK> dev <DEVICE>

ip route add 192.168.254.1/24  dev ens33

Others:

ip route delete …

ip route change …

ip route flush ..

ip route flush table

Know about Netplan:

Path:  /etc/netplan

/etc/netplan/*.yaml are some important configuration files.

Netplan commands:

netplan apply

netplan generate

netplan try

ping command:

ping hostname

ping ip_address

Example:

host command:
Finds IP from host name
Example:

dig command:

Also, to find the IP address from the name.
dig www.google.ca

Example Output:

nslookup

Also, to find the IP address from the name.
nslookup www.google.ca

Example:
nslookup www.google.ca

Leave a Reply