Today I wanted to set up my Linux box so that it had a static ip address for shared resources like Samba.

The network card that I happen to be using for it was eth0. If you are using a different one then you may need to modify the code below to match the eth* that you are using.

Here are the steps that I took to accomplish this:

1. I edited the /etc/network/interfaces file with:

CODE:
  1. sudo nano /etc/network/interfaces

2. I added the following lines:

CODE:
  1. auto eth0
  2. iface etho inet static
  3. address 192.168.1.2
  4. netmask 255.255.255.0
  5. gateway 192.168.1.1

3. I restarted networking on the box and all was good.

sudo /etc/init.d/networking restart

Pay close attention to the netmask and the gateway. If these are different you will need to make adjustments as needed. I found these in my routers web gui.

My completed /etc/network/interfaces now looks like:

CODE:
  1. auto lo
  2. iface lo inet loopback
  3.  
  4. auto eth0
  5. iface etho inet static
  6. address 192.168.1.2
  7. netmask 255.255.255.0
  8. gateway 192.168.1.1

Linux networking samba static ip address ubuntu

« »