PDA

View Full Version : [ubuntu] Static IP Address Help



Knight-Server
September 7th, 2009, 05:25 PM
I suppose I should have tried registering on the forums and asking first before trying stuff from google searches...

I'm trying to give my computer a static ip address because I don't have a monitor for it (borrowing my wife's at the moment), and would like to just connect via remote desktop to a computer plugged in with network cable and power cord...

I have figured out remote desktop, and I have figured out how to edit my /etc/network/interfaces file. I made some changes from some websites stating "how to make a static ip" but I'm getting an error.

My File:


auto lo
iface lo inet loopback
auto eth0
iface eth0 inet static
address 192.168.1.110
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.0.1
gateway 192.168.0.1


user@comp:~$ sudo /etc/init.d/networking restart
* Reconfiguring network interfaces...
SIOCDELRT: No such process
SIOCADDRT: No such process
Failed to bring up eth0.
Any ideas?

MrWES
September 7th, 2009, 06:20 PM
Are you behind a router? If so, the gateway might be 192.168.1.1 .

matt79
September 7th, 2009, 06:26 PM
I am not sure but I think I had the same problem. This is how I think I fixed it. Plus some of your addresses are corrected, like the gateway and broadcast.

auto lo
iface lo inet loopback
address 127.0.0.1

auto eth0
iface eth0 inet static
address 192.168.1.110
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Knight-Server
September 7th, 2009, 06:35 PM
Thank you for your help.

Now for the next problem:

When I restarted the machine, the static ip worked, however I can't reach the internet on that machine.

:(

matt79
September 7th, 2009, 07:17 PM
can you ping your gateway from that machine?
try: ping -c 5 192.168.1.1

PunkLV
September 7th, 2009, 07:20 PM
Post the output of ifconfig
And check if /etc/resolv.conf contains anything

mike555
September 7th, 2009, 08:16 PM
I have noticed that most times it better to shut down for a couple of minutes in between settings to let the router reset ...

The Cog
September 8th, 2009, 12:33 AM
You probably need to add the DNS nameservers address to /etc/resolv.conf. One line per nameserver like this:
nameserver 192.168.1.1
but if your gateway doesn't also act as a nameserver, you will have to enter the address of a nameserver that your ISP gives you instead.

Knight-Server
September 10th, 2009, 12:41 PM
can you ping your gateway from that machine?
try: ping -c 5 192.168.1.1

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=1.28 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.954 ms
64 bytes from 192.168.1.1: icmp_seq=3 ttl=64 time=0.950 ms
64 bytes from 192.168.1.1: icmp_seq=4 ttl=64 time=0.962 ms
64 bytes from 192.168.1.1: icmp_seq=5 ttl=64 time=0.938 ms

--- 192.168.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4004ms
rtt min/avg/max/mdev = 0.938/1.017/1.284/0.137 ms

Knight-Server
September 10th, 2009, 12:44 PM
Post the output of ifconfig
And check if /etc/resolv.conf contains anything


eth0 Link encap:Ethernet HWaddr 00:50:2c:07:48:50
inet addr:192.168.1.110 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::250:2cff:fe07:4850/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:2834 errors:0 dropped:0 overruns:0 frame:0
TX packets:3246 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:198625 (198.6 KB) TX bytes:2589870 (2.5 MB)
Interrupt:23 Base address:0xe000

lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:12 errors:0 dropped:0 overruns:0 frame:0
TX packets:12 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:936 (936.0 B) TX bytes:936 (936.0 B)

/etc/resolv.conf has "# Generated by NetworkManager"

ukripper
September 10th, 2009, 12:45 PM
You probably need to add the DNS nameservers address to /etc/resolv.conf. One line per nameserver like this:
nameserver 192.168.1.1
but if your gateway doesn't also act as a nameserver, you will have to enter the address of a nameserver that your ISP gives you instead.

As suggested by The Cog above, you need to add your nameserver in resolv.conf to make it work.

Knight-Server
September 12th, 2009, 01:05 AM
works!

cranecreek
September 12th, 2009, 03:00 AM
Matt had it right on:
Your ISP should have supplied you with the gateway and dns ips.

Take a look at /etc/network/interfaces

From my Debian server:


# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
allow-hotplug eth1
iface eth1 inet static
address xx.xx.xx.xx(your ip)
netmask xx.xx.xx.xx(Get from your isp)
network xx.xx.xx.xx(Get from your isp)
broadcast xx.xx.xx.xx(Get from your isp)
gateway xx.xx.xx.xx(Get from your isp)
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers xx.xx.xx.xx , xx.xx.xx.xx(Your isps name servers)
dns-search your domain if you have one.com
Whatever you use bind or any other dns jail it and sym link to it.

Hope that helps