To use a static IP address, you add the static method for the interface in the file /etc/network/interfaces.
Procedure
-
Obtain your current address, network mask, and broadcast address.
device# ifconfig
...
eth0 Link encap:Ethernet HWaddr 00:0a:21:ff:45:2a
inet addr:10.10.10.0 Bcast:10.10.10.255 Mask:255.255.255.0
...
This example displays the first Ethernet interface identified as eth0.
-
Obtain your gateway and network address.
device# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.10.10.2 0.0.0.0 UG 100 0 0 eth0
172.16.77.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
Use flags
u and
g for the route gateway. The other IP address is the network IP address.
-
Open the interfaces file.
device# sudo nano /etc/network/interfaces
Nano is the GNU version of the Pico text editor. Use the editor of your choice.
-
Find the DHCP settings in the /interfaces file. They will appear as text similar to the following example.
...
auto eth0
iface eth0 inet dhcp
...
-
Replace the settings shown in step 4 with the following settings.
...
auto eth0
iface eth0 inet static
address 10.0.0.100
netmask 255.255.255.0
gateway 10.0.0.0
...
This example configures the first Ethernet interface, identified as eth0.
-
Save the file and exit to the command prompt.
-
Make sure that your name server IP address is your gateway IP address.
device# sudo nano /etc/resolv.conf
-
Restart the networking components.
device# sudo /etc/init.d/networking restart
-
If you want this as a permanent change, remove the DHCP client so it can no longer assign dynamic IP addresses.
device# sudo apt-get remove dhcp-client
-
Verify connectivity.
device# ping www.extremenetworks.com
-
Manually enable the interface.