Linux‎ > ‎

Linux-Networking

Basics - Changing IP

posted Oct 7, 2012, 9:36 PM by Joe Bieber

To change the IP address of a networking adapter, you need to modify the /etc/network/interfaces file.
Open a terminal and use your favorite text editor to make your changes.
In a graphical desktop environment, like Ubuntu, Mint, Etc. you can right-click on the network icon on the panel and select "edit connections". 

sudo gedit /etc/network/interfaces
sudo pluma /etc/network/interfaces

In a non-gui server environment, I like to use 'nano'(It's easy) or you can use 'vim'(takes a bit to get used to).

sudo nano /etc/network/interfaces

sudo vi /etc/network/interfaces

example:
auto eth0 
iface eth0 inet static 
    address 192.168.2.100 
    netmask 255.255.255.0 
    network 192.168.2.1 
    broadcast 192.168.2.255

Once you've saved your changes, you need to restart networking in order for your new settings to take effect.
Here's how:

sudo /etc/init.d/networking restart

Use ifconfig to confirm your settings have changed.

Basics - ifconfig

posted Oct 7, 2012, 9:29 PM by Joe Bieber

To display network settings in a terminal on Linux, use ifconfig, not to be confused with the Windows command ipconfig, which basically does the same thing in a Windows environment.

Use:

ifconfig

example result:
eth0    Link encap:Ethernet  HWaddr 01:0c:29:8d:44:06  
          inet addr:192.168.2.222  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe8d:4405/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:17304 errors:0 dropped:0 overruns:0 frame:0
          TX packets:9398 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:25263154 (24.0 MiB)  TX bytes:669213 (653.5 KiB)

A manual page for ifconfig for reference.
http://linux.die.net/man/8/ifconfig

1-2 of 2