PDA

View Full Version : static IP Debian 5



philly
8th January, 2013, 07:55 PM
Hi all,
I am wondering if anyone can help me with setting my IP to static on my debian PC. With putty and using the command nano /etc/network/ interfaces I can see and change the DHCP entry to Static. However after I reboot I cannot now access the internet.
Is this a DNS issue and if so where do I set this up.
Thanks in advance,

zOOge
9th January, 2013, 07:56 PM
Hi all,
I am wondering if anyone can help me with setting my IP to static on my debian PC. With putty and using the command nano /etc/network/ interfaces I can see and change the DHCP entry to Static. However after I reboot I cannot now access the internet.
Is this a DNS issue and if so where do I set this up.
Thanks in advance,

Example:
frd@cardserv:/etc/network$ cat interfaces
auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.1.99
netmask 255.255.255.0
gateway 192.168.1.254

philly
9th January, 2013, 08:13 PM
Example:
frd@cardserv:/etc/network$ cat interfaces
auto lo
iface lo inet loopback

iface eth0 inet static
address 192.168.1.99
netmask 255.255.255.0
gateway 192.168.1.254

Thanks for your reply.
At the moment when I run this command 'nano /etc/network/interfaces' I get the following,

# The primary network interface
auto eth0
iface eth0 inet dhcp
address 192.168.1.127
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1

I then change the dhcp to static and save and reboot. After doing this I cannot get on to the internet. I also noticed that at the moment my server is working in dhcp mode with Ip 192.168.1.101 however I am still getting the above which is 192.168.1.127 which is not the case.
Confused

digicon
10th January, 2013, 01:28 AM
I tried this when i ran debian 6 and it never worked, i did read that it can cause issues so i went with the advice od setting the static ip in the router itself. Just a Thought

mtv1
10th January, 2013, 01:35 AM
change the auto to lo

but tbh all routers (well most)

you can make the client static so no need to do it in debian config ;)

network local lan clientlist in mine you can reserve the ip

wilf
10th January, 2013, 12:30 PM
spent hours looking into this myself, dont waste your time do as the others do. use router!

philly
10th January, 2013, 11:15 PM
[quote=digicon;1830416]I tried this when i ran debian 6 and it never worked, i did read that it can cause issues so i went with the advice od setting the static ip in the router itself. Just a Thought[/quo
Thanks guys for your reply's.
I use a lynksys WAG 120N router which I understand does not have the option for locking an IP to a mac address. However I can specify a starting IP and the number of addresses to issue. Maybe this will sort things out for me.

Thanks all.

philly
11th January, 2013, 08:04 PM
I tried this when i ran debian 6 and it never worked, i did read that it can cause issues so i went with the advice od setting the static ip in the router itself. Just a Thought
Thanks digicon,
My router is a Lynksys and this does not support dhcp reservation so I am snookered. I need to lock the IP on the PC. To clarify if I browse to etc/network/interfaces and see my IP settings etc. I change the dhcp to static, save and reboot. I can then ping the PC but cannot access the internet.
Thanks in advance.

digicon
11th January, 2013, 08:34 PM
Hi Philly,

As i say i tried on mine and it created problems so mine is done through the Router, Not sure if you can do it on yours but i would have thought 99% of routers allow an IP allocation.

You could try the Wiki guide to set the static IP:

NetworkConfiguration - Debian Wiki (http://wiki.debian.org/NetworkConfiguration#Configuring_the_interface_man ually)

philly
11th January, 2013, 10:30 PM
Hi Philly,

As i say i tried on mine and it created problems so mine is done through the Router, Not sure if you can do it on yours but i would have thought 99% of routers allow an IP allocation.

You could try the Wiki guide to set the static IP:

NetworkConfiguration - Debian Wiki (http://wiki.debian.org/NetworkConfiguration#Configuring_the_interface_man ually)

Thanks digicon,
I checked out the Wiki guide before. My settings are the same but for some reason when I set to static my internet is lost. Would this have something to do with DNS. Apparently the Lynksys wag120N although a very reliable unit does not support IP allocation.
Just in case it makes a difference Network Manager is installed on my system.

GastonJ
12th January, 2013, 11:00 PM
What's the results of:

ifconfig
netstat -rn
cat /etc/resolv.conf

philly
12th January, 2013, 11:29 PM
What's the results of:

ifconfig
netstat -rn
cat /etc/resolv.conf
Hi GastonJ,
Here are the net details etc.

eth0 Link encap:Ethernet HWaddr 00:0d:61:82:be:e0
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::20d:61ff:fe82:bee0/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:287756 errors:0 dropped:0 overruns:0 frame:0
TX packets:226312 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:22771698 (22.7 MB) TX bytes:24591878 (24.5 MB)
Interrupt:19 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:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
################################################## #####################################

Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0
192.168.1.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
################################################## #########################################

nameserver 208.67.222.222
nameserver 208.67.220.220
nameserver 89.19.64.36

binamee
13th January, 2013, 07:10 PM
This should do :ciao:

$ nano /etc/network/interfaces


auto eth0
iface eth0 inet static
address 192.168.1.221
netmask 255.255.255.0
gateway 192.168.1.254
dns-nameservers 192.168.1.254

philly
14th January, 2013, 11:37 AM
This should do :ciao:

$ nano /etc/network/interfaces


auto eth0
iface eth0 inet static
address 192.168.1.221
netmask 255.255.255.0
gateway 192.168.1.254
dns-nameservers 192.168.1.254

Thanks binamee,
I will try your suggestion. I had it as above but I did not have any detail for the DNS.
Will let you know how it goes.

fail2ban
14th January, 2013, 12:35 PM
Thanks binamee,
I will try your suggestion. I had it as above but I did not have any detail for the DNS.
Will let you know how it goes.

Actually, above you had

iface eth0 inet dhcp

Which in itself says to networking to ignore lines after it and do dhcp instead of static IP.

philly
14th January, 2013, 07:33 PM
Thanks dzoner,
I will put the following in etc/network/interfaces, I will change my IP and gateway that is currently working. Is this correct.

auto eth0
iface eth0 inet static
address 192.168.1.155
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.254

fail2ban
14th January, 2013, 08:00 PM
Thanks dzoner,
I will put the following in etc/network/interfaces, I will change my IP and gateway that is currently working. Is this correct.

auto eth0
iface eth0 inet static
address 192.168.1.155
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.254
Yes, that's ok.

in /etc/resolv.conf you have dns servers in case that that's not working with the last line.

philly
15th January, 2013, 10:51 AM
Yes, that's ok.

in /etc/resolv.conf you have dns servers in case that that's not working with the last line.
Thanks,
All ok now. Just wanted to get to the bottom of this one. I did get around the problem by setting the two other PC's in the house to static and disabling the DHCP in the router. As this Linux PC is for me to mess around with I was not worried if I crashed it a some stage as it cost me zero, however the only way to learn is to get stuck in.
Thanks to all other members who gave me a dig-out.
keep up the good work.