linux_wiki:static_ip

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux_wiki:static_ip [2014/11/17 21:50]
billdozor created
linux_wiki:static_ip [2019/05/25 23:50]
Line 1: Line 1:
-====== Static IP ====== 
  
-**Distro(s):** Debian and Redhat based. 
- 
-**Description:** Configure static IP, Mask, Gateway, and DNS. 
- 
-Assuming eth0 is the network interface to edit; 
- 
-__**Debian/Ubuntu Systems**__ 
-if possible, bring interface down first: ifdown eth0. 
- 
-1) Edit /etc/network/interfaces 
-<code> 
-nano /etc/network/interfaces 
-</code> 
- 
-2) DHCP Setup Example (Default) 
-<code> 
-auto eth0 
-iface eth0 inet dhcp 
-</code> 
- 
-3) Static Setup Example 
-<code> 
-auto eth0 
-iface eth0 inet static 
-  address 192.168.0.100 
-  netmask 255.255.255.0 
-  gateway 192.168.0.254 
-  dns-nameservers 8.8.8.8 8.8.4.4 
-</code> 
- 
-4) Bring the interface up (if brought down at the start) 
-<code> 
-ifup eth0 
-</code> 
- 
-5) Otherwise, restart to fix nameserver conflicts between dhclient and static. 
-<code> 
-shutdown -r now 
-</code> 
- 
-__**Redhat/CentOS Systems**__ 
- 
-1) Edit /etc/sysconfig/network-scripts/ifcfg-eth0 
-<code> 
-vi /etc/sysconfig/network-scripts/ifcfg-eth0 
-</code> 
- 
-2) DHCP Setup Example (Default) 
-<code> 
-DEVICE=eth0 
-ONBOOT=no (change to yes to have DHCP start automatically) 
-NM_CONTROLLED=yes 
-BOOTPROTO=dhcp 
-</code> 
- 
-3) Static Setup Example 
-<code> 
-DEVICE=eth0 
-ONBOOT=yes 
-NM_CONTROLLED=yes 
-BOOTPROTO=static 
-IPADDR=192.168.0.101 
-NETMASK=255.255.255.0 
-GATEWAY=192.168.0.254 
-</code> 
- 
-4) Edit /etc/resolv.conf 
-<code> 
-vi /etc/resolv.conf 
- 
-nameserver 8.8.8.8 
-nameserver 8.8.4.4 
-</code> 
- 
-5) Restart network service 
-<code> 
-/etc/init.d/network restart 
-</code> 
  • linux_wiki/static_ip.txt
  • Last modified: 2019/05/25 23:50
  • (external edit)