Skip to main content

Networking in Linux

 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

Popular posts from this blog

Linux basic commands

 Linux basic commands: du  -sh  *  |  sort  -h  -r   |  head  -n  40  :    list out first 40 files in the directory that are taking more space in the directory.  cd : change directory Is-l listing the items in long listing format  pwd : print working directory Is-I format: type :no of links:owner : group:size :month :day :time :name cd/: go to/directory whoami: tells us by which username we are logged in. touch jerry: creates the file named jerry in present working directory. cp jerry lex: copy the content of jerry file and paste it to lex file. vi text1: creates the file text1 and open it in vi editor mkdir superman: creates the directory called superman mkdir abc def  : creates 2 folder in one command. touch filename wont work in /etc/ folder if logged in by normal account. man cp: shows manual for cp command. echo "india is my country"> file1 puts the text in file1. rm filename: remove the filename  mv lex luther renames the file from lex to luther  mv luther /h

patching tasks

 Patching a Linux system is a critical task to ensure that the system remains secure, stable, and up-to-date with the latest features and fixes. Here’s a comprehensive guide to the tasks involved in Linux patching: 1. Pre-Patching Preparation Backup System : Ensure you have a full system backup, including critical data, configuration files, and applications. Test the backup to verify its integrity. Check Disk Space : Verify that you have enough disk space, particularly on /var , /tmp , and /boot partitions. Review Current Patch Level : Determine the current patch level and installed packages using package management tools like yum , apt , dpkg , or rpm . Check System Logs : Review system logs to identify any issues that might affect the patching process. Test in a Staging Environment : If possible, apply patches in a staging environment that mirrors production to identify potential issues. Notify Stakeholders : Inform stakeholders about the scheduled maintenance window and expected do