Static IP address
There are various reasons why you may wish to assign static IP addresses on your network. For instance, one may gain a certain degree of predictability with unchanging addresses, or you may not have a DHCP server available.
A static address can be configured with most networking tools standard in Arch Linux, for example see netctl, systemd-networkd, dhcpcd.
The following describes how to configure a static IP address manually. You need:
- Static IP address
- Subnet mask in CIDR notation, for example
/24is the CIDR notation of255.255.255.0netmask. - Broadcast address
- Gateway‘s IP address
- Name server (DNS) IP addresses. See also resolv.conf.
If you are running a private network, it is safe to use IP addresses in 192.168.*.* for your IP addresses, with a subnet mask of 255.255.255.0 and a broadcast address of 192.168.*.255. The gateway is usually 192.168.*.1 or 192.168.*.254.
iface eth0 inet static
address 192.168.1.16
netmask 255.255.255.0
gateway 192.168.1.1
————-
Above is not for debian.
Important!
Everything is in file: /etc/network/interfaces
Never put more than one gateway!!