Linux/IPv4: Difference between revisions

From Wiki
(Die Seite wurde neu angelegt: „* dhcp iface eth0 inet dhcp * static iface eth0 inet static address 192.168.0.97 netmask 255.255.255.0 gateway 192.168.0.1 dns-namese…“)
 
m (Marcluer verschob die Seite Linux/IP nach Linux/IPv4, ohne dabei eine Weiterleitung anzulegen)
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
== /etc/network/interfaces ==
* dhcp  
* dhcp  
 
<blockquote>
<pre>
iface eth0 inet dhcp
iface eth0 inet dhcp
 
</pre>
 
</blockquote>
* static
* static
 
<blockquote>
<pre>
iface eth0 inet static
iface eth0 inet static
     address 192.168.0.97   
     address 192.168.0.97   
Line 11: Line 14:
     gateway 192.168.0.1
     gateway 192.168.0.1
     dns-nameservers 192.168.0.1 10.10.0.2
     dns-nameservers 192.168.0.1 10.10.0.2
</pre>
</blockquote>
== netplan (Ubuntu 18.04+) ==
* static
<pre>
network:
    ethernets:
        enp0s3:
            addresses: [192.168.1.2/24]
            gateway4: 192.168.1.1
            nameservers:
              addresses: [8.8.8.8,8.8.4.4]
            dhcp4: no
    version: 2
</pre>
[[Category:Linux/Network]]
[[Category:Linux]]

Latest revision as of 07:58, 27 September 2021

/etc/network/interfaces

  • dhcp
iface eth0 inet dhcp
  • static
iface eth0 inet static
    address 192.168.0.97   
    netmask 255.255.255.0  
    gateway 192.168.0.1
    dns-nameservers 192.168.0.1 10.10.0.2


netplan (Ubuntu 18.04+)

  • static
network:
    ethernets:
        enp0s3:
            addresses: [192.168.1.2/24]
            gateway4: 192.168.1.1
            nameservers:
              addresses: [8.8.8.8,8.8.4.4]
            dhcp4: no
    version: 2