To configure your Ethernet device with a static IP address and custom configuration, some more information will be required.
Suppose you want to assign the IP address 192.168.0.2 to the device eth1, with the typical netmask of 255.255.255.0.
Your default gateway’s IP address is 192.168.0.1. You would enter something like this into /etc/network/interfaces:
iface eth1 inet static
address 192.168.0.2
netmask 255.255.255.0
gateway 192.168.0.1
If you have only one Ethernet device, eth0, and it gets its configuration from a DHCP server, and it should come up automatically at boot, only two additional lines are required:
auto eth0
iface eth0 inet dhcp
The first line specifies that the eth0 device should come up automatically when you boot. The second line means that interface (“iface”) eth0 should have an IPv4 address space (replace “inet” with “inet6” for an IPv6 device) and that it should get its configuration automatically from DHCP
Post a Comment