Assigning a static IP address on the TPVM Linux OS

To use a static IP address, you add the static method for the interface in the file /etc/network/interfaces.

Procedure

  1. 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.
  2. 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.
  3. 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.
  4. Find the DHCP settings in the /interfaces file. They will appear as text similar to the following example.
    ...
    auto eth0
    iface eth0 inet dhcp 
    ...
    
  5. 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.
  6. Save the file and exit to the command prompt.
  7. Make sure that your name server IP address is your gateway IP address.
    device# sudo nano /etc/resolv.conf
    
  8. Restart the networking components.
    device# sudo /etc/init.d/networking restart
    
  9. 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
    
  10. Verify connectivity.
    device# ping www.extremenetworks.com
    
  11. Manually enable the interface.
    device# sudo ifup eth0