linux_wiki:static_ip

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
linux_wiki:static_ip [2018/03/06 10:06]
billdozor [Redhat/CentOS Systems]
linux_wiki:static_ip [2019/05/25 23:50] (current)
Line 15: Line 15:
 if possible, bring interface down first: ifdown eth0. if possible, bring interface down first: ifdown eth0.
  
-  * Edit /etc/network/interfaces<code bash>nano /etc/network/interfaces</code>+  * Edit /etc/network/interfaces<code bash>vim /etc/network/interfaces</code>
  
   * DHCP Setup Example (Default)<code bash>auto eth0   * DHCP Setup Example (Default)<code bash>auto eth0
Line 35: Line 35:
 ==== Redhat/CentOS Systems ==== ==== Redhat/CentOS Systems ====
  
-  * Edit /etc/sysconfig/network-scripts/ifcfg-eth0<code bash>vi /etc/sysconfig/network-scripts/ifcfg-eth0</code>+Classic and NetworkManager methods of setting IP addresses for EL distros. 
 + 
 +=== Classic (network) Method === 
 + 
 +Using config files and the network service. 
 + 
 +  * Edit /etc/sysconfig/network-scripts/ifcfg-eth0<code bash>vim /etc/sysconfig/network-scripts/ifcfg-eth0</code>
  
   * DHCP Setup Example (Default)<code bash>DEVICE=eth0   * DHCP Setup Example (Default)<code bash>DEVICE=eth0
Line 50: Line 56:
 GATEWAY=192.168.0.254</code> GATEWAY=192.168.0.254</code>
  
-  * Edit /etc/resolv.conf<code bash>vi /etc/resolv.conf+  * Edit /etc/resolv.conf<code bash>vim /etc/resolv.conf
  
 nameserver 8.8.8.8 nameserver 8.8.8.8
Line 56: Line 62:
  
   * Restart network service<code bash>/etc/init.d/network restart</code>   * Restart network service<code bash>/etc/init.d/network restart</code>
 +
 +=== Network Manager ===
 +
 +Using the NetworkManager service.
 +
 +\\
 +Static IP/Gateway
 +  * Set a static IP on an existing interface (eth0)<code bash>nmcli con mod eth0 autoconnect yes ipv4.method manual ip4 192.168.1.50/24 gw4 192.168.1.254</code>
 +  * Apply settings<code bash>nmcli con up eth0</code>
 +
 +\\
 +Static DNS
 +  * Set a static DNS entry<code bash>nmcli con mod eth0 ipv4.dns 1.1.1.1</code>
 +  * Apply changes<code bash>nmcli con up eth0</code>
 +
 +----
  
  • linux_wiki/static_ip.1520348801.txt.gz
  • Last modified: 2019/05/25 23:50
  • (external edit)