Debian: Set Static IP: Difference between revisions

From wiki.jacobjohns.com
jwiki>jjohns
Created page with "center|frameless #Backup the interfaces file to desired backup location. #*<code>cp /etc/network/interfaces /usr/bu</code> #Edit the original file to the below setting desired static IP #*<code> # This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo..."
 
m 4 revisions imported
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
[[File:Debian logo.png|center|frameless]]
[[File:Debian logo.png|center|frameless]]
 
<hr /><br />
#Backup the interfaces file to desired backup location.
#Backup the original interfaces file to desired backup location.
#*<code>cp /etc/network/interfaces /usr/bu</code>
#*<code>cp /etc/network/interfaces /usr/bu</code>
#Edit the original file to the below setting desired static IP
#Modify the original file, configuring:
#*<code>
#*<code>iface <interface> inet static</code>
#*<code>address <desired static ip></code>
#*<code>netmask <netmask></code>
#*<code>gateway <gateway></code>
#*<code>dns-nameservers <nameserver ip> <nameserver ip></code>
#Save the file and restart the networking service.
#*<code>systemctl restart networking.service</code>
#Confirm the IP address with <code>ip a</code>.
#The interfaces file should resemble the below.
   &#35; This file describes the network interfaces available on your system
   &#35; This file describes the network interfaces available on your system
   &#35; and how to activate them. For more information, see interfaces(5).
   &#35; and how to activate them. For more information, see interfaces(5).
Line 14: Line 22:
   iface lo inet loopback
   iface lo inet loopback
    
    
   &#35;The primary network interface
   &#35; The primary network interface
   &#35;allow-hotplug ens192
   &#35; allow-hotplug ens192
   &#35;iface ens192 inet dhcp
   &#35; iface ens192 inet dhcp
    
    
   auto ens192
   auto ens192
   iface ens192 inet static
   iface ens192 inet static
     address 192.168.11.248
     address 10.168.123.234
     netmask 255.255.255.0
     netmask 255.255.0.0
     gateway 192.168.11.1
     gateway 10.168.11.300
     dns-nameservers 192.168.11.201 192.168.11.253
     dns-nameservers 1.0.0.1 1.0.0.3
</code>

Latest revision as of 16:06, 27 July 2024

Error creating thumbnail: File missing


  1. Backup the original interfaces file to desired backup location.
    • cp /etc/network/interfaces /usr/bu
  2. Modify the original file, configuring:
    • iface <interface> inet static
    • address <desired static ip>
    • netmask <netmask>
    • gateway <gateway>
    • dns-nameservers <nameserver ip> <nameserver ip>
  3. Save the file and restart the networking service.
    • systemctl restart networking.service
  4. Confirm the IP address with ip a.
  5. The interfaces file should resemble the below.
 # This file describes the network interfaces available on your system
 # and how to activate them. For more information, see interfaces(5).
 
 source /etc/network/interfaces.d/*
 
 # The loopback network interface
 auto lo
 iface lo inet loopback
 
 # The primary network interface
 # allow-hotplug ens192
 # iface ens192 inet dhcp
 
 auto ens192
 iface ens192 inet static
   address 10.168.123.234
   netmask 255.255.0.0
   gateway 10.168.11.300
   dns-nameservers 1.0.0.1 1.0.0.3