5.5.5. The network interface with the static IP
The network interface served by the static IP is configured by creating the configuration entry in the "/etc/network/interfaces
" file as the following.
allow-hotplug eth0 iface eth0 inet static address 192.168.11.100 netmask 255.255.255.0 gateway 192.168.11.1 dns-domain example.com dns-nameservers 192.168.11.1
When the Linux kernel detects the physical interface eth0
, the allow-hotplug
stanza causes ifup
to bring up the interface and the iface
stanza causes ifup
to use the static IP to configure the interface.
Here, I assumed the following.
IP address range of the LAN network:
192.168.11.0
-192.168.11.255
IP address of the gateway:
192.168.11.1
IP address of the PC:
192.168.11.100
The
resolvconf
package: installedThe domain name: "
example.com
"IP address of the DNS server:
192.168.11.1
When the resolvconf
package is not installed, DNS related configuration needs to be done manually by editing the "/etc/resolv.conf
" as the following.
nameserver 192.168.11.1 domain example.com
![]() | Caution |
---|---|
The IP addresses used in the above example are not meant to be copied literally. You have to adjust IP numbers to your actual network configuration. |