# can not connect to internet?

## pmam

Hi, 

I do not know if it has to do to that problem, however, I added NetworkManager and wifi card to one of my machines,

and suddenly the wired Internet connection was stopped. 

ifconfig seems ok so I do not know what went wrong.

Due to this problem I can not paste here command's output but I will try to write down here the relevant details.

EDIT: This comand is ok: 

```
ping -c 3 8.8.8.8
```

but no connection through firefox... strange

----------

## gerdesj

Can you resolve hostnames:

```

$host www.google.com

```

----------

## pmam

Dear gerdesj,

 *Quote:*   

> Can you resolve hostnames: 

 

Very nice question... and the answer is NO - 

Do not know what has changed... 

Please advise!

Thanks

----------

## krinn

You must check your /etc/resolv.conf content.

If you want test and use google dns just do

```
echo nameserver 8.8.8.8 >> /etc/resolv.conf
```

----------

## NeddySeagoon

pmam,

What do you have in /etc/resolv.conf ?

You need at least one nameserver line.

If ifconfig shows both wired and wireless interfaces connected in the same subnet that wont work.

Stop one of the interfaces.

The output of route will also help.  You may have at most one default route.

----------

## pmam

Dear NeddySeagoon & krinn,

You are right! 

Probably my actions with the wireless card and networkmanager, changed /etc/resolv.conf content:

I checked this file in other machine and found out this missing line: nameserver 8.8.8.8 , as you noted, so I added it:

```
# Generated by NetworkManager

nameserver 8.8.8.8
```

Now I can connect to Internet!   :Very Happy: 

Can you please add short explanation - Why this line - at least one default route - is essential?

I did not find this demand in the documents.

 *Quote:*   

> If ifconfig shows both wired and wireless interfaces connected in the same subnet that wont work.
> 
> Stop one of the interfaces. 

 

I stopped wireless - However, what is the right way to configure wired & wireless in regards to ifconfig below?

```
ifconfig

enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 10.0.0.6  netmask 255.255.255.0  broadcast 10.0.0.255                                                                                                                  

        inet6 fe80::21d:7dff:fe70:7eb4  prefixlen 64  scopeid 0x20<link>                                                                                                            

        ether 00:1d:7d:70:7e:b4  txqueuelen 1000  (Ethernet)                                                                                                                        

        RX packets 389166  bytes 255004442 (243.1 MiB)                                                                                                                              

        RX errors 0  dropped 0  overruns 0  frame 0                                                                                                                                 

        TX packets 421782  bytes 161262972 (153.7 MiB)                                                                                                                              

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                                                                                  

                                                                                                                                                                                    

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536                                                                                                                                        

        inet 127.0.0.1  netmask 255.0.0.0                                                                                                                                           

        inet6 ::1  prefixlen 128  scopeid 0x10<host>                                                                                                                                

        loop  txqueuelen 0  (Local Loopback)                                                                                                                                        

        RX packets 32  bytes 1922 (1.8 KiB)                                                                                                                                         

        RX errors 0  dropped 0  overruns 0  frame 0                                                                                                                                 

        TX packets 32  bytes 1922 (1.8 KiB)                                                                                                                                         

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0                                                                                                                  

                                                                                                                                                                                    

wlp3s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500                                                                                                                                

        ether 00:1d:0f:b6:67:89  txqueuelen 1000  (Ethernet)                                                                                                                        

        RX packets 0  bytes 0 (0.0 B)                                                                                                                                               

        RX errors 0  dropped 0  overruns 0  frame 0                                                                                                                                 

        TX packets 0  bytes 0 (0.0 B)                                                                                                                                               

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
```

Thanks a lot

----------

## NeddySeagoon

pmam,

Heres my kernel routing table by way of an illustration.  Its there twice so you can see hostnames and IP addresses.

```
roy@NeddySeagoon_Static ~ $ route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

default         router          0.0.0.0         UG    2      0        0 eth0

loopback        *               255.0.0.0       U     0      0        0 lo

loopback        localhost       255.0.0.0       UG    0      0        0 lo

192.168.100.0   *               255.255.255.0   U     0      0        0 eth0

roy@NeddySeagoon_Static ~ $ route -n

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

0.0.0.0         192.168.100.253 0.0.0.0         UG    2      0        0 eth0

127.0.0.0       0.0.0.0         255.0.0.0       U     0      0        0 lo

127.0.0.0       127.0.0.1       255.0.0.0       UG    0      0        0 lo

192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 eth0

roy@NeddySeagoon_Static ~ $ 
```

When a packet is te be routed. the kernel looks at the desinatian IP in the header and applies the rutes from the bottom of the list, working towards the top.

If a packet is destined for 192.168.100.0/24, its just sent out of eth0 as its on my local sub net. No gateway is required.

Lets skip  127.0.0.0.

Packets that get to the top of the list, 0.0.0.0 matches any destination IP, are sent to 192.168.100.253, which is my next hop towards the internet.

My PC has no idea how to reach such IPs so the packet is sent onwards.  

This process is repeated at every 'hop' until the destination is reached. traceroute shows this.

```
# traceroute -I google.com

traceroute to google.com (74.125.230.130), 30 hops max, 60 byte packets

 1  router (192.168.100.253)  1.079 ms  1.081 ms  1.099 ms

 2  losubs.subs.dsl1.wh-man.zen.net.uk (62.3.87.145)  16.665 ms  16.888 ms  16.900 ms

 3  no-dns-yet-62-3-80-197.zen.co.uk (62.3.80.197)  17.569 ms  17.747 ms  17.762 ms

 4  ge-3-0-0-0.cr2.th-lon.zen.net.uk (62.3.80.45)  23.602 ms  24.027 ms  24.028 ms

 5  ge-2-0-0-0.cr1.th-lon.zen.net.uk (62.3.80.41)  24.041 ms  24.054 ms  24.069 ms

 6  72.14.217.190 (72.14.217.190)  24.083 ms  22.983 ms  22.986 ms

 7  209.85.244.184 (209.85.244.184)  23.809 ms  22.537 ms  24.100 ms

 8  209.85.250.171 (209.85.250.171)  22.572 ms  22.575 ms  22.575 ms

 9  lhr08s05-in-f2.1e100.net (74.125.230.130)  22.367 ms  23.021 ms  23.463 ms
```

The above shows my route to google .com, so my connection to google.com is through eight other systems.

The first hop is my router, as described above.  It has a default route to my ISP ...

----------

## Jaglover

Nameserver is not route, actually. It is resolver, please see http://en.wikipedia.org/wiki/Domain_Name_System

----------

## pmam

NeddySeagoon, 

Thanks for your nice explanation - It gives a practical point of view,

that help to figure out what i s going on there... inside the box. 

I am trying to configure again wireless interface with NetworkManager,

and find out that during the configuration this line: 'nameserver 8.8.8.8' is deleted from /etc/resolv.conf - 

Strange but it happens.. Also wireless is not working OK -sometimes yes and not - 

So I will open a new topic...

----------

## Roman_Gruber

why do you use network manager.

make the connection by hand as user root. ususally dhcpcd interfacename is enough for that, you can automate this too but i do it by typing dhcpcd

----------

## RazielFMX

 *tw04l124 wrote:*   

> why do you use network manager.
> 
> make the connection by hand as user root. ususally dhcpcd interfacename is enough for that, you can automate this too but i do it by typing dhcpcd

 

Network Manager is great when you move between networks frequently. I used to use it years ago on my laptop.

Are you using dhcpcd or dhclient with NetworkManager? If you aren't sure, you can run and post the output of the following and it will give us a clue:

```
equery uses networkmanager
```

----------

## UberLord

 *RazielFMX wrote:*   

> Network Manager is great when you move between networks frequently.

 

You can also use dhcpcd-gtk or dhcpcd-qt (if the updated ebuilds ever hit portage) for the same job.

----------

## pmam

RazielFMX, 

I am using static IP for wired interfaces - I have devices mounted to machines - so should be an order.  

However for wireless maybe I can use dhcpd -but still prefer static -

could be a problem if wireless will take by chance one of the static IP - right?

If I will not manage I will do it by hand as tw04l124 said.

Here is the output:

```
equery uses networkmanager

[ Legend : U - final flag setting for installation]

[        : I - package is installed with flag     ]

[ Colors : set, unset                             ]

 * Found these USE flags for net-misc/networkmanager-0.9.8.10-r1:

 U I

 + + avahi              : Add avahi/Zeroconf support

 + + bluetooth          : Enable Bluetooth Support

 - - connection-sharing : Use net-dns/dnsmasq and net-firewall/iptables for connection sharing

 + + consolekit         : Use sys-auth/consolekit for session tracking

 - - dhclient           : Use dhclient from net-misc/dhcp for getting ip

 + + dhcpcd             : Use net-misc/dhcpcd for getting ip

 - - gnutls             : Add support for net-libs/gnutls (TLS 1.0 and SSL 3.0 support)

 + + introspection      : Add support for GObject based introspection

 + + modemmanager       : Enable support for mobile broadband devices using net-misc/modemmanager

 + + nss                : Use dev-libs/nss for cryptography

 + + ppp                : Enable support for mobile broadband and PPPoE connections using net-dialup/ppp

 - - resolvconf         : Use net-dns/openresolv for managing DNS information

 - - systemd            : Enable use of systemd-specific libraries and features like socket activation or session tracking

 - - test               : Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in make.conf/package.use anymore

 - - vala               : Enable bindings for dev-lang/vala

 + + wext               : Enable support for the deprecated Wext (Wireless Extensions) API; needed for some older drivers (e.g. ipw2200, ndiswrapper)

 + + wifi               : Enable support for wifi and 802.1x security using net-wireless/wpa_supplicant
```

Thanks

----------

## UberLord

One obvious thought is that there is no DNS solution via DHCP over the wifi link and if NM doesn't know about your static setup it may wipe it out.

IF using NM (or dhcpcd for everything as in the link below), then it needs to know all configuration OR install a tool such as openresolv to be the middleman for you.

----------

## RazielFMX

Interesting.

I've never attempted static network configuration with Network Manager. Your best bet might be dropping Network Manager and adding dhcpcd to your default run level (if you use OpenRC). You can configure dhcpcd to use static definitions.

You can check out https://wiki.archlinux.org/index.php/Dhcpcd for more on dhcpcd.

If you are using systemd, I would review this:

https://wiki.archlinux.org/index.php/Network_configuration#Static_IP_address

Finally, you can do what @tw04l124 stated and do everything by hand.

----------

## RazielFMX

 *UberLord wrote:*   

>  *RazielFMX wrote:*   Network Manager is great when you move between networks frequently. 
> 
> You can also use dhcpcd-gtk or dhcpcd-qt (if the updated ebuilds ever hit portage) for the same job.

 

A GUI version of dhcpcd! The next time I attempt the insanity of Gentoo on a laptop I will definitely check that out!

----------

## UberLord

 *RazielFMX wrote:*   

> A GUI version of dhcpcd! The next time I attempt the insanity of Gentoo on a laptop I will definitely check that out!

 

 :Smile: 

Just remember to try 0.7.3 or newer. Earlier versions are a touch unreliable and don't work well with the newer dhcpcd's in portage.

Hence me adding the Gentoo ticket in my .sig to try and get dhcpcd-ui updated in portage.

----------

## pmam

RazielFMX,

 *Quote:*   

> I've never attempted static network configuration with Network Manager.

 

I think this may causing to this problem - Till now have not used NetworkManager for static IP - 

I did it by hand. But now, I thought it is a good idea to use NM for wireless configuration - 

May be it is not OK, and I need to continue configuring by hand the wireless, as well.

I see it also from replies of other guys here...

I need to read the attached links and see how to go a head...

I am using openRC

Thanks

----------

## pmam

OK - I see that NetworkManager is not so suitable to my setup - 

I already configured wired interface by hand (no GUI)

and want to add wireless interface by hand - but have some issues:

I am not going to use dhcpcd since I need static IP - 

I have some mounted devices to machine, so could be some mess using dynamic IP.

I have done according this guide: http://wiki.gentoo.org/wiki/Wifi.

Now trying to follow this guide: https://www.gentoo.org/doc/en/handbook/handbook-amd64.xml?part=4&chap=4 - 

I understand that I have to use wpa_supplicant (or wireless-tools)  - right?

Anyway, I installed wpa_supplicant, however, do not figure out what exactly to add to /etc/conf.d/net - 

My WIFI router details is: WEP, open, and static IP is needed.   

Please advise me how to configure this setup?

----------

## UberLord

 *pmam wrote:*   

> I am not going to use dhcpcd since I need static IP

 

dhcpcd can setup static addresses as well.

Click the link in my sig!

----------

