Author Topic: How to switch to static IP (what to enter into the DNS field)  (Read 779 times)

0 Members and 1 Guest are viewing this topic.

Offline m0l0ko

  • Peasant
  • *
  • Posts: 129
  • Cookies: -4
    • View Profile
How to switch to static IP (what to enter into the DNS field)
« on: September 02, 2013, 02:10:07 pm »
EDIT: I figured out that its a problem with my hardware, not the IP configuration. So this thread isn't a waste of webspace, I'll change the question, but will leave the original thread at the bottom just in case anyone can learn from it.

QUESTION: Does it matter what DNS server I use? For example, if I enter 8.8.8.8, it seems to work. Would another DNS server work just as well?


ORIGINAL THREAD:

Heres what I tried:

but it doesn't work. It tells me I'm connected to the wired network, but I can't access any websites, I can't even access local IPs on the LAN. 192.168.1.33 is available, 255.255.255.0 is the correct netmask and 192.168.1.1 is my routers IP, so the only thing I'm unsure of is the DNS. I used 8.8.8.8 which I believe is googles DNS.

If the DNS is incorrect, that would mean I can't access websites, but I should still be able to access my router shouldn't I? I tried to figure out what DNS is used when I let the DHCP server do everything for me, but I don't know how. I tried this:

Quote
horse@box:~$ cat /etc/resolv.conf
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf( 8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search localdomain
but 127.0.1.1 obviously isn't a DNS server. If I'm not mistaken, DNS just turns domain names into IPs though, so I should be able to access websites by directing my browser to their IP, but thats not working.

BTW I'm on Ubuntu
« Last Edit: September 02, 2013, 02:19:51 pm by m0l0ko »

Offline RedBullAddicted

  • Moderator
  • Sir
  • *
  • Posts: 519
  • Cookies: 189
    • View Profile
Re: How to switch to static IP (what to enter into the DNS field)
« Reply #1 on: September 02, 2013, 02:22:28 pm »
Hi,

in most cases the router runs a dns service (in your case DNS = 192.168.1.1) but it does not look like this would be your problem. You try to access your router by its dns name or by ip address? Can you set your connection to dhcp and post the content of /etc/dhcp/dhclient.conf. Please post the content of /etc/network/interfaces and /etc/resolv.conf too. Your /etc/network/interfaces should look similar to:

Code: [Select]
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.1.33
netmask 255.255.255.0
gateway 192.168.1.1

in most cases you need to restart the networking service with service networking restart or /etc/init.d/network restart.
I have often seen that eth0 does not come up afterwards. If thats the case force it to come up with ifconfic eth0 up. Have a look with ifconfig to see if the new ip address is listed. If it comes up with no address the easiest way is to just reboot. After the reboot everything should work find. Try to send a icmp echo request to your routers ip to see if it is reachable. Afterwards try to nslookup anything on the internet to see if dns resolution works.

Cheers,
RBA
Deep into that darkness peering, long I stood there, wondering, fearing, doubting, dreaming dreams no mortal ever dared to dream before. - Edgar Allan Poe

Offline m0l0ko

  • Peasant
  • *
  • Posts: 129
  • Cookies: -4
    • View Profile
Re: How to switch to static IP (what to enter into the DNS field)
« Reply #2 on: September 02, 2013, 07:17:22 pm »
If I try to connect to the wired network with DHCP, it just won't connect, but with the wifi connection, heres whats in the files:

/etc/dhcp/dhclient.conf:

Quote
# Configuration file for /sbin/dhclient, which is included in Debian's
#    dhcp3-client package.
#
# This is a sample configuration file for dhclient. See dhclient.conf's
#    man page for more information about the syntax of this file
#    and a more comprehensive list of the parameters understood by
#    dhclient.
#
# Normally, if the DHCP server provides reasonable information and does
#    not leave anything out (like the domain name, for example), then
#    few changes must be made to this file, if any.
#

option rfc3442-classless-static-routes code 121 = array of unsigned integer 8;

#send host-name "andare.fugue.com";
send host-name = gethostname();
#send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
#send dhcp-lease-time 3600;
#supersede domain-name "fugue.com home.vix.com";
#prepend domain-name-servers 127.0.0.1;
request subnet-mask, broadcast-address, time-offset, routers,
    domain-name, domain-name-servers, domain-search, host-name,
    netbios-name-servers, netbios-scope, interface-mtu,
    rfc3442-classless-static-routes, ntp-servers,
    dhcp6.domain-search, dhcp6.fqdn,
    dhcp6.name-servers, dhcp6.sntp-servers;
#require subnet-mask, domain-name-servers;
#timeout 60;
#retry 60;
#reboot 10;
#select-timeout 5;
#initial-interval 2;
#script "/etc/dhcp3/dhclient-script";
#media "-link0 -link1 -link2", "link0 link1";
#reject 192.33.137.209;

#alias {
#  interface "eth0";
#  fixed-address 192.5.5.213;
#  option subnet-mask 255.255.255.255;
#}

#lease {
#  interface "eth0";
#  fixed-address 192.33.137.200;
#  medium "link0 link1";
#  option host-name "andare.swiftmedia.com";
#  option subnet-mask 255.255.255.0;
#  option broadcast-address 192.33.137.255;
#  option routers 192.33.137.250;
#  option domain-name-servers 127.0.0.1;
#  renew 2 2000/1/12 00:00:01;
#  rebind 2 2000/1/12 00:00:01;
#  expire 2 2000/1/12 00:00:01;
#}

/etc/network/interfaces:
Code: [Select]
# interfaces(5) file used by ifup( 8) and ifdown( 8)
auto lo
iface lo inet loopback


/etc/resolv.conf:

Code: [Select]
# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver 127.0.1.1
search localdomain
« Last Edit: September 02, 2013, 07:19:47 pm by m0l0ko »

xC

  • Guest
Re: How to switch to static IP (what to enter into the DNS field)
« Reply #3 on: September 02, 2013, 07:25:47 pm »
Why don't use just set it to automatic configuration instead of manual?