Network configuration in Linux has always seemed daunting, but it’s not the case honestly. In this article, we will see how easy it is to perform networking configuration in Linux ubuntu server.
We will be performing all the networking config on Ubuntu Linux. But it’s relatively applicable to other Linux distribution as well. We will look at the setup of the static IP address, network interface, ethernet interface, and more. Let’s learn Ubuntu networking!
Note: The examples below are not done on Cloud Server, but rather locally on a VM Simulator i.e. VMware.
Prerequisite
- Must have Linux OS or its Virtual Machine (YouTube Tutorial)
- Basic Linux commands hands-on. (Check here)
Table of Content
Networking Configuration in Linux Ubuntu
Identify Ethernet Interface
First, we need to create a shell script file. Execute the following command to create and open a shell script with ‘nano’ text editor.
Another way to show available network interfaces is through the following IP command:
The network interface that we are concerned with will be against the ‘logical name’. In the image shown, it is ens33
Configure Default Gateway IP Address
IP configuration for the default gateway executes the IP command shown below. Note that the default gateway IP address should be according to the network IP assigned previously.
The below IP command is to confirm the change in network IP for the default gateway.
Network Config in Linux: Assigning IP Address
Permanent IP Address Assignment
We can temporarily assign an IP address to our server. This assignment is not permanent and will be reset once the server is rebooted.
For permanent IP assignment, open up Network Configuration File:
Open the YAML file and copy the below code in it.
But before you do that, make sure that THE STATIC IP YOU ASSIGN IS IN THE SAME NETWORK AS OTHER SERVERS. Otherwise, you won’t be able to ping or connect to other server.
After saving the file, you need to apply the changes. Run the command below:
To ensure the new network configuration has taken effect, you can check the network interface with the following command:
Temporary IP Assignment
In the above command, you will directly execute on the console, and then can confirm with “ip add” command.
You do need to replace the ip address and network interface “ens33” with the one you require and have.
How to Change Hostname in Linux
Super simple. Just open hostname file with superuser privileges and change the hostname. And then simply reboot.
Change the hostname to whatever you want, and then reboot your system.
How to Assign a Hostname to an IP Address
1. Open the /etc/hosts File
2. Edit the /etc/hosts File
Add a new line at the bottom of the file to map the IP address to the hostname. The format is:
3. Save & Verify the Changes
After saving the file, and then you can verify that the hostname is correctly assigned by pinging the hostname:
If the mapping is correct, you should see responses from 192.168.1.100.
Reset all Network Settings in Ubuntu Linux
In order to reset all network settings in the Ubuntu Linux server to the default one, execute the following command:
Although, the above command would not reset the DNS nameserver IP in /etc/resolv.conf file. For that simply reboot your server or reset it manually.
Network Configuration Using the GUI
Previously we configured network settings for the Ubuntu Linux server through the command line. Now we will be configuring network interface using GUI.
How to give a Static IP Address
Let’s see how to configure static IP address. First, open up the Settings >> Network >> Wired setting icon. Refer to the image shown below. Go to the IPv4 tab and then select the ‘Manual’ option to assign a static IP address.
Here you should give the appropriate static IP, netmask, and default gateway address. Take reference from the image below:
After you are done, check the IP address from the ip addr command.
How to give a Dynamic IP Address through DHCP Server
Assigning dynamic IP address in Ubuntu Server through GUI works the same way as assigning static IP.
Open the Settings >> Network >> Wired setting icon. Then go to the IPv4 tab and select Automatic (DHCP). That’s it!
As the name suggests, the DHCP server will automatically assign all the relevant IP addresses wherever needed. Take reference from the image below.
Changing Hostname in Ubuntu Linux
It’s very easy to change a hostname in Linux. Using a text editor like Vim or nano, open hostname file with the below command:
In this file, you will see your current hostname. Simply change it and save it. You may want to reboot your Linux Server before you can see the change.
Firewall Setup in Linux
A firewall is known for filtering good from bad incoming and outgoing traffic requests. It’s an essential step in fortifying your server’s security and a must to implement.
Allowing Various Protocols Traffic from the Firewall
The first thing we need to ensure is that ufw is installed on our Ubuntu server.
To verify ufw is running on your server, execute the following command:
If the above command returns statement as follow:
Then the firewall is not set up or enabled on your server. First, you need to install ufw and then enable it to start the firewall. For that, execute the following command:
But if the ufw is already installed and enabled, then you still need to make sure that incoming traffic is allowed through various protocols.
For that, execute the following commands.
The above commands will open up some ports and start running services to receive traffic.
- OpenSSH will be enabled if you want to connect to your server using SSH protocol.
- On ports 20 and 21, your FTP protocol would be running.
- Port 990 would be used for TLS (Transport Layer Security).
- Lastly, ports ranging from 40000 to 50000 are enabled for later services to be assigned to them.
After setting all the traffic rules, let’s check the status of our Firewall.
Something like the one below should show up. Meaning that we have successfully enabled and configured our server’s Firewall.
And that’s a wrap!
Again, these commands will only work on a LINUX terminal on Ubuntu server. And a common way to run Linux with Windows is to start a Virtual Machine using VMware.
I hope this article helped you How to manage networking configuration in Linux Ubuntu. You may also want to read about How to add Users, Group, and Linux Processes & Scheduling Algorithm. Please like this article and leave your reviews in the comment section below.
Have a great one!
Add Your Heading Text Here
Recent Comments
Archives
- June 2026
- May 2026
- October 2025
- October 2024
- September 2024
- August 2024
- June 2024
- January 2024
- November 2023
- October 2023
- September 2023
- August 2023
- June 2023
- May 2023
- March 2023
- December 2022
- November 2022
- October 2022
- September 2022
- August 2022
- July 2022
- June 2022
- May 2022
- April 2022
- February 2022
- January 2022
- December 2021
- November 2021
- October 2021
- September 2021
- August 2021
- July 2021
Categories
- 21
- aks 1 en
- aks 18
- aks 28
- aks 31
- Angular
- AWS
- Backend Development
- Big Data
- Blog
- Cloud
- crypto 01
- crypto 05
- crypto 15
- crypto 20
- crypto 20.05
- crypto 21.05
- crypto 29
- crypto 5
- Database
- Deployment
- DevOps
- Docker
- fi
- Frontend Development
- GitHub
- Google Cloud Platform
- hu
- Installations
- it
- Java
- JavaScript
- Linux
- MySQL
- Networking
- News
- nl
- no
- NodeJS
- Online casino
- Operating System
- Post
- public
- Python
- Python Flask
- Report
- Security
- Server
- SpringBoot
- Subdomain
- sushicasino 13
- TypeScript
- Uncategorized
- VSCode
- Webhosting
- WordPress
- Στοιχηματικές
Search
Recent Post
Daxili_oyunçu_təcrübəsi_pinco_download_vasitəsilə_yüksək_mərc_riskləri
- 23 June, 2026
- 9 min read
Возможности_платформы_и_олимп_казино_скача
- 23 June, 2026
- 1 min read
Превосходный_геймплей_и_Olimp_Casino_вход_ваш_шан
- 23 June, 2026
- 1 min read