<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://kangtain.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Debian%3A_Network_Configuration</id>
	<title>Debian: Network Configuration - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://kangtain.com/wiki/index.php?action=history&amp;feed=atom&amp;title=Debian%3A_Network_Configuration"/>
	<link rel="alternate" type="text/html" href="https://kangtain.com/wiki/index.php?title=Debian:_Network_Configuration&amp;action=history"/>
	<updated>2026-05-13T03:30:08Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.45.1</generator>
	<entry>
		<id>https://kangtain.com/wiki/index.php?title=Debian:_Network_Configuration&amp;diff=8382&amp;oldid=prev</id>
		<title>Kangmus: Created page with &quot; To view current network configurations, run the following command in Terminal. It will show the output for each interface in a separate section.  $ ip a or  $ ifconfig  == Change network configuration == Basic network configuration includes setting a static or dynamic IP address, adding a gateway, DNS server information. There are different ways to configure the network on Debian OS.  === Method 1: Use ifconfig and route command === In this method, we will see how to co...&quot;</title>
		<link rel="alternate" type="text/html" href="https://kangtain.com/wiki/index.php?title=Debian:_Network_Configuration&amp;diff=8382&amp;oldid=prev"/>
		<updated>2024-04-15T23:14:23Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot; To view current network configurations, run the following command in Terminal. It will show the output for each interface in a separate section.  $ ip a or  $ ifconfig  == Change network configuration == Basic network configuration includes setting a static or dynamic IP address, adding a gateway, DNS server information. There are different ways to configure the network on Debian OS.  === Method 1: Use ifconfig and route command === In this method, we will see how to co...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&lt;br /&gt;
To view current network configurations, run the following command in Terminal. It will show the output for each interface in a separate section.&lt;br /&gt;
 $ ip a&lt;br /&gt;
or&lt;br /&gt;
 $ ifconfig&lt;br /&gt;
&lt;br /&gt;
== Change network configuration ==&lt;br /&gt;
Basic network configuration includes setting a static or dynamic IP address, adding a gateway, DNS server information. There are different ways to configure the network on Debian OS.&lt;br /&gt;
&lt;br /&gt;
=== Method 1: Use ifconfig and route command ===&lt;br /&gt;
In this method, we will see how to configure network settings. However, remember, these settings will not be permanent. Once you reboot your system, the settings will be removed.&lt;br /&gt;
&lt;br /&gt;
==== 1. Assign an IP address to the interface ====&lt;br /&gt;
We will use ifconfig to assign an IP address to our network interface. Below is the syntax of the command:&lt;br /&gt;
 sudo ifconfig &amp;lt;interface&amp;gt; &amp;lt;IP_address&amp;gt; netmask &amp;lt;subnetmask&amp;gt; up&lt;br /&gt;
In the following example, the command assigns the IP address 192.168.72.165 to the network interface eth0. The network mask is 24 (255.255.255.0) bits.&lt;br /&gt;
 sudo ifconfig eth0 192.168.72.165 netmask 255.255.255.0 up&lt;br /&gt;
&lt;br /&gt;
==== 2. Set the Default Gateway ====&lt;br /&gt;
The default gateway is the address used to communicate with the outside network. To configure the default gateway, use the following command syntax:&lt;br /&gt;
 sudo route add default gw &amp;lt;IP_address&amp;gt; &amp;lt;interface&amp;gt;&lt;br /&gt;
In the following example, I am using 192.68.72.2 as my default gateway address.&lt;br /&gt;
 sudo route add default gw 192.168.72.2 eth0&lt;br /&gt;
&lt;br /&gt;
==== 3. Set Your DNS server ====&lt;br /&gt;
DNS server resolves a domain name to an IP address so the browser can load Internet resources. To configure the DNS name server address, use the following command syntax:&lt;br /&gt;
 echo “nameserver &amp;lt;IP_address&amp;gt;” &amp;gt; /etc/resolv.conf&lt;br /&gt;
In the following example, I am setting Google’s public DNS IP address as my nameservers address that is 8.8.8.8.&lt;br /&gt;
 echo “nameserver 8.8.8.8” &amp;gt; /etc/resolv.conf&lt;br /&gt;
Once done, you can test your configuration by running the ifconfig command as follows:&lt;br /&gt;
&lt;br /&gt;
==== Remove IP address from a network interface ====&lt;br /&gt;
To remove an IP address from a network interface, run the following command in Terminal:&lt;br /&gt;
 ip address del &amp;lt;IP_address&amp;gt; dev &amp;lt;interface&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Method 2: Change network settings by using the interfaces file ===&lt;br /&gt;
This method will configure permanent network settings that your system will remember even after a reboot. For that, we will have to edit &amp;#039;&amp;#039;&amp;#039;/etc/network/interfaces&amp;#039;&amp;#039;&amp;#039; file using any text editor. Run the following command in the terminal to do so:&lt;br /&gt;
 sudo nano /etc/network/interfaces&lt;br /&gt;
Then add the following lines in it:&lt;br /&gt;
 auto eth0&lt;br /&gt;
 iface eth0 inet static&lt;br /&gt;
 address 192.168.72.165&lt;br /&gt;
 netmask 255.255.255.0&lt;br /&gt;
 gateway 192.168.72.2&lt;br /&gt;
Now press &amp;#039;&amp;#039;&amp;#039;Ctrl+O&amp;#039;&amp;#039;&amp;#039; and then &amp;#039;&amp;#039;&amp;#039;Ctrl+X&amp;#039;&amp;#039;&amp;#039; to save and exit the file.&lt;br /&gt;
&lt;br /&gt;
Please note that the address, netmask, and gateway line must start with leading whitespace! In case, you want to assign the address, use the following lines dynamically:&lt;br /&gt;
 auto eth0&lt;br /&gt;
 iface eth0 inet dhcp&lt;br /&gt;
&lt;br /&gt;
==== Defining the (DNS) Nameservers ====&lt;br /&gt;
We will need to edit the /etc/resolv to add DNS server information&amp;#039;&amp;#039;&amp;#039;.conf&amp;#039;&amp;#039;&amp;#039; file. Run the following command to do so:&lt;br /&gt;
 nano /etc/resolv.conf&lt;br /&gt;
I am adding here two Nameservers. One is Google&amp;#039;s public DNS server address and the other is my router’s IP address.&lt;br /&gt;
 nameserver 8.8.8.8&lt;br /&gt;
 nameserver 192.168.72.2&lt;br /&gt;
Now press &amp;#039;&amp;#039;&amp;#039;Ctrl+O&amp;#039;&amp;#039;&amp;#039; and then &amp;#039;&amp;#039;&amp;#039;Ctrl+X&amp;#039;&amp;#039;&amp;#039; to save and exit the file.&lt;br /&gt;
&lt;br /&gt;
Once done, you can verify the IP address using &amp;#039;&amp;#039;&amp;#039;ip a&amp;#039;&amp;#039;&amp;#039; or &amp;#039;&amp;#039;&amp;#039;ifconfig&amp;#039;&amp;#039;&amp;#039; command.&lt;br /&gt;
&lt;br /&gt;
=== Method 3: Change network configuration through Debian GUI ===&lt;br /&gt;
In this method, we will use the graphical way for configuring the basic network settings.&lt;br /&gt;
&lt;br /&gt;
To do so, hit the windows button on your keyboard, then in the search bar type &amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;settings&amp;#039;&amp;#039;&amp;#039;&amp;#039;&amp;#039;. From the results that appear, open the &amp;#039;&amp;#039;&amp;#039;Settings&amp;#039;&amp;#039;&amp;#039;. Then on the left sidebar, click on the &amp;#039;&amp;#039;&amp;#039;Network&amp;#039;&amp;#039;&amp;#039; tab. After that, click on the gear icon of the interface that you want to configure.&lt;br /&gt;
&lt;br /&gt;
Go to &amp;#039;&amp;#039;&amp;#039;IPv4&amp;#039;&amp;#039;&amp;#039; tab. Choose &amp;#039;&amp;#039;&amp;#039;Manual&amp;#039;&amp;#039;&amp;#039; and enter the IP address, netmask, gateway, and DNS.&lt;br /&gt;
&lt;br /&gt;
In case you want to dynamically assign the IP address, choose the Automatic (DHCP) option and enter the DNS information.&lt;br /&gt;
&lt;br /&gt;
Once done, click on &amp;#039;&amp;#039;&amp;#039;Apply&amp;#039;&amp;#039;&amp;#039; to save the changes.&lt;br /&gt;
&lt;br /&gt;
==== Setting up Hostname ====&lt;br /&gt;
Like the IP address, a unique hostname is also used to recognize a system on a network. To find the current hostname of your system, run the below command in Terminal:&lt;br /&gt;
 hostname&lt;br /&gt;
To change the system&amp;#039;s hostname, you can run the below command. But once you reboot your system, your original hostname will be restored.&lt;br /&gt;
 hostname host_name&lt;br /&gt;
I am changing here my hostname from Debian to Debian10.&lt;br /&gt;
&lt;br /&gt;
To permanently change the host name, you will need to edit hostname file located at &amp;#039;&amp;#039;&amp;#039;/etc/hostname&amp;#039;&amp;#039;&amp;#039;. Enter the below command to do so:&lt;br /&gt;
 sudo nano /etc/hostname&lt;br /&gt;
This file contains only the hostname of the file. Change the old name to your desired name, and then press &amp;#039;&amp;#039;&amp;#039;Ctrl+O&amp;#039;&amp;#039;&amp;#039; and &amp;#039;&amp;#039;&amp;#039;Ctrl+X&amp;#039;&amp;#039;&amp;#039; to save and exit.&lt;br /&gt;
&lt;br /&gt;
Some other useful commands you might require while setting up a network in a Debian OS:&lt;br /&gt;
&lt;br /&gt;
==== Ping ====&lt;br /&gt;
It can test connectivity between two systems on aLAN or WAN. To test connectivity to a device, type ping followed by the IP or hostname of that device:&lt;br /&gt;
 ping &amp;lt;IP or hostname&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== Arp: ====&lt;br /&gt;
Arp is used to translate IP addresses into Ethernet addresses. To print arp table, type:&lt;br /&gt;
 arp –a&lt;br /&gt;
&lt;br /&gt;
==== Route ====&lt;br /&gt;
It is used to display the routing table of a Linux system.&lt;br /&gt;
 route&lt;br /&gt;
&lt;br /&gt;
==== Host ====&lt;br /&gt;
It translates host names to IP addresses and vice versa.&lt;br /&gt;
&lt;br /&gt;
To find IP against a specified domain:&lt;br /&gt;
 host domain_name&lt;br /&gt;
To find a domain name against the specified IP address.&lt;br /&gt;
 host IP_address&lt;br /&gt;
&lt;br /&gt;
==== Enable and disable the interface ====&lt;br /&gt;
To enable up the interface, use:&lt;br /&gt;
 ifup &amp;lt;interface&amp;gt;&lt;br /&gt;
To bring down the interface, use:&lt;br /&gt;
 ifdown &amp;lt;interface&amp;gt;&lt;br /&gt;
That is all there is to it! In this article, we have explained how to setup a basic network in Debian OS. We have discussed different methods including the graphical and command-line based. You can choose the one that you find more easy and convenient.&lt;br /&gt;
&lt;br /&gt;
== Source ==&lt;br /&gt;
&lt;br /&gt;
* [https://vitux.com/network-configuration-in-debian/ vitux.com]&lt;br /&gt;
&lt;br /&gt;
[[Category:Linux]]&lt;br /&gt;
[[Category:Debian]]&lt;br /&gt;
[[Category:Network]]&lt;/div&gt;</summary>
		<author><name>Kangmus</name></author>
	</entry>
</feed>