Networking in Linux :
ifconfig : lists the ip address and network interface like eth0/eth1/enpos3/lo .
ip addr : lists the interface and ip address .
ip r l : lists ip address .
hostname -I : lists the IP address .
netstat -rnv : gives the gateway information .
ping www.google.com : ping the ip address of the google .
nslookup www.google.com : it will give the ip address of the google.com and also it will give ip address of our dns server .
Note : if you have the personal linux computer , your dns server and gateway would be same .
systemctl status NetworkManager : shows the status of network manager .
ps -ef | grep NetworkManager : shows the process which is running the network manager .
........................................
Network configuration methods :
1. nmcli : stands for network manager command line interface .This tool is useful when access to graphical environment is not available to make the network configuration changes .
2 .nmtui : stands for network manager text user interface . this tool can be run in any terminal window.
and allows the changes to be made .
3 . nm-connection-editor : Full graphical management tool providing the access to most of the network management configuration options .it can only be accessed through the desktop or webconsole .
4. GNOME Setings : it allows the basic network management tasks to be performed .
nmcli : gives the information about the adaptors .
nmcli connection show : gives the list of the network interfaces .
nmcli --help : it shows the options that can be used with nmcli .
nmcli connection --help : it shows the options that can be used with nmcli connection .
Question : How to assign the static ip address to the linux machine using the nmcli ?
Answer : fire the below commands :
nmcli device
nmcli connection modify enpos3 ipv4.addresses 10.253.1.34/24
nmcli connection modify enpos3 ipv4.gateway 10.253.1.1
nmcli connection modify enpos3 ipv4.method manual
nmcli connection modify enpos3 ipv4.dns 8.8.8.8
nmli connection down enpos3
nmcli connection up enpos3
ip address show enpos3
nmcli connection show
Question : How to add the secondary static ip to the server using nmcli ?
Answer : Fire the below commands :
nmcli device status
nmcli connection show -active
ifconfig
nmcli connection modify enpos3 +ipv4.addresses 10.0.0.211/24
nmcli connection reload
systemctl reboot
ip address show
.........................
Network Files and basic commands as a linux admin we should know :
files :
/etc/sysconfig/network-scripts/ifcfg-enpos3
/etc/hosts
/etc/hostname : contains the hostname of the linux machine . we can change it .
/etc/resolv.conf : gives the information and ip of the dns server .
/etc/nsswitch.conf
Commands :
ping : pings the ipaddress and output shows if it is pingable or not .
ifconfig : shows the network interface
ip r l : gives the ip address
hostname -I : gives only the ip address .
ifup or ifdown : ifup is to activate the network interface and ifdown is for deactivating the network interface .
netstat : it shows the statistics of the network .
traceroute : its a tool for understanding the internet connection problems .
tcpdump : tracing everything that is coming inside of your computer and going outside of your computer.
nslookup : it is used to check the dns entry associated with the ip address.
ethtool enpos3 : gives the information about your interface .
Comments
Post a Comment