# Where is my network !?

## TitiTwister

Hi world !

So I just finished my second gentoo and both times I got the same problem : I don't have access to internet.

I can't ping ==> connect: Network is unreachable.

So here is my ifconfig : ifconfig

My /etc/conf.d/net : net

The /etc/hosts file : hosts

I'm new to this so hope it's not something stupid to have troubles with ^^

Thanks for your help !

B.T.W. I'm on VMware and my "network adapter" is on Bridged (but it doesn't work on NAT either).

----------

## tryn

TitiTwister

 One thing that might help is this.

```
config_eth0="dhcp"
```

 Instead of this.

```
#config_eth0="dhcp"
```

 From what you have posted yours is commented out.

----------

## NeddySeagoon

TitiTwister,

What does 

```
ifconfig -a
```

  show?

An empty or missing net file uses dhcpcd.  Did you install dhcpcd, if not you don't have it?

Your hosts file should have the defaults for

```
127.0.0.1

::1
```

The FQDN and its aliases go against the real IP on a static setup or are provided by dhcp if you use dhcp

----------

## krinn

Networking for dummies  :Wink: 

1/ find your card

 *Quote:*   

> lspci -k | grep -A5 Ether
> 
> 04:00.0 Ethernet controller: Realtek Semiconductor Co., Ltd. RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller (rev 02)
> 
> 	Subsystem: ASUSTeK Computer Inc. M3A78-EH Motherboard
> ...

 

a/ your card is -> Realtek blahblah

b/ what driver you need -> Kernel driver in use: -> r8169

c/ Kernel modules answer to "Is my driver buildin the kernel or as module" -> Kernel modules -> so build as module

d/ not having the driver, you have no network card working -> network unreachable error

2/ name my interface?

 *Quote:*   

> ls /sys/class/net/ -l
> 
> total 0
> 
> lrwxrwxrwx 1 root root 0  1 mai   17:31 eth0 -> ../../devices/pci0000:00/0000:00:1c.2/0000:04:00.0/net/eth0
> ...

 

a) note that 04:00.0 is the pci ref from lspci output, telling you THAT card is using that name eth0

b) because of udev/systemd madness, that little eth0 could be some cryptic name everyone knows is only made to bug users. To get this back is another story.

c) WTF i have no eth0 thing!!! see #1d

d) WTF i couldn't spell the interface name my card is using! see #2b

4/ build a link to it

 *Quote:*   

> ln -s /etc/init.d/net /etc/init.d/net.eth0

 

5/ configure it

 *Quote:*   

> cat /etc/conf.d/net
> 
> config_eth0="192.168.0.4 netmask 255.255.255.0 brd 192.168.0.255"
> 
> routes_eth0="default via 192.168.0.100"

 

a) the via mean "send information to that device", so "set the routing table to send information from eth0 to 192.168.0.100". It is then just your router IP

b) 192.168.0.4 if you use an address not in the same range as your route (so 192.168.0.any) you'll get "network unreachable". Make sure they match.

6/ dns resolving

 *Quote:*   

> cat /etc/resolv.conf
> 
> nameserver 192.168.0.100
> 
> nameserver 8.8.8.8
> ...

 a) nameserver is the server that will translate www.this.com into an IP, so it's the address of someone that will do that for you, in this case, first nameserver is the router, as many router can answer that easy

b) 8.8.8.8 that's google dns resolver, not really the best to use for your privacy, as your IP asking whois is sure gold info to track you. But that's a good one to test and because many users aren't aware of the dns their provider use (do i mean users are lost in space? well, it's network for dummies there)

c) bad dns, not dns setup... -> unknown host error

7/ How can i start it?

 *Quote:*   

> /etc/init.d/net.eth0 start

 

8/ It cannot be that easy?

Of course not, NeddySeagoon is know to do it eyes closed, but i don't recommend it. If you have eyes open i'm afraid it is that easy.

In case you are lost, having an ifconfig showing only lo, mean you are a #1d case.Last edited by krinn on Mon May 11, 2015 9:26 pm; edited 1 time in total

----------

## TitiTwister

 *tryn wrote:*   

> TitiTwister
> 
>  One thing that might help is this.
> 
> ```
> ...

 

Done and no changes =S

 *NeddySeagoon wrote:*   

> 
> 
> What does 
> 
> ```
> ...

 

I'm pretty sure I did yeah, but how can I check ? Because maybe I did on the 66 previous VM and not this one.

Here the ifconfig -a : ifconfi -a

----------

## TitiTwister

 *krinn wrote:*   

> Networking for dummies 
> 
> 1/ find your card
> 
>  *Quote:*   lspci -k | grep -A5 Ether
> ...

 

Ok I don't have the module ... tell me I don't have to do all the kernel config again ...

----------

## krinn

No, i won't tell you.

But you need to add that option to your kernel, and (i'm sure you won't like that), you have two choices (well, three in fact):

a) build the driver buildin the kernel -> need recompile, and install it -> make && make install

b) build the driver as module -> need to recompile modules and install them (make modules && make modules_install)

c) If your kernel was so badly built that you lack some symbols and the modules compilation fail, it is well, really just because you did an ugly kernel for networking  :Smile: 

In this case, you're doom, making it as module or build in, you will have to recompile the kernel AND the modules so they get the new symbols too.

But even you miss to add your network card driver, could we assume you weren't crazy enough to not miss all networking options?

In case you are doom to c) or scared by a) or b) just use c) It is nothing more than just checking the network driver for your card that will force you to check other needed options to enable it, and the "OMG it was so hard to configure" is just limit to typing: make && make modules modules_install && make install

Just to be sure: you know your driver name to use right? I mean, not everyone use r8169, that's the one for my card in my example, and if you don't have that kind of card... Because also i'm unsure if a card under vmware need some vmware driver or just its native one.

----------

## TitiTwister

 *krinn wrote:*   

> a) build the driver buildin the kernel -> need recompile, and install it -> make && make install
> 
> b) build the driver as module -> need to recompile modules and install them (make modules && make modules_install)
> 
> c) If your kernel was so badly built that you lack some symbols and the modules compilation fail, it is well, really just because you did an ugly kernel for networking 
> ...

 

Well I got this : here

So do I need both driver and module ?

If so, how can I do the make && make_install command again ?

----------

## Jaglover

Actually, if you enable it as a module you need to do make modules and make modules_install, this will enable your NIC, no reboot needed.

----------

## krinn

TitiTwister: you seems a bit lost with "driver" and "module".

That's the same. Say i need the r8169 for my card. I'm going to my kernel source and look where is the r8169 driver.

If i check <*> or <M>, i will have the driver, it's just the handling that will change, but the driver will be there.

<*> the driver is build inside your kernel, it mean everytime your kernel boot, the driver is load (even you don't have the card, it is just load). So if you build it like that, it mean you need to reboot.

<M> the driver is load when you ask it to load, for most people, they will still not need to ask it loaded, as dev manager (eudev, udev...) will load it for you when it see you have a device that need it (but when the device is discovered, and except if the device is hotplug, it is then when booting).

So if you build it as module, you install it, and as your card is not hotplug, you need to ask it loaded: modprobe r8169 (or lazzy ones can just reboot, and it will be discovery at booting by dev manager that will use his little fingers and type <modprobe r8169> for you).

As you fail to see, your pic showing your lspci -k output, still didn't gave you the driver name to use. That's because your kernel doesn't have the driver at all. To get it, you can google that, or wait some users giving you the answer, or browse the kernel and search what driver match it, or redo the <lspci -k> but with a kernel that handle many drivers (including the one you need). That's the kind of kernel you have in installationcd that of course have as many as possible.

But it is more for kernel for dummies than network for dummies  :Wink: 

If you need more about kernel, read the linux sea (excellent) from sven http://swift.siphos.be/linux_sea/

Or you can check kernel entry in the gentoo wiki (that sure sucks) http://wiki.gentoo.org

----------

## TitiTwister

Ok I'm getting close I think ^^

So now I know I need this driver now : AMD PCNet32 PCI support.

Which is now built in my kernel. But still no changes ( it's this one I had before rebooting for the first time ).

The lspci run still show no driver in use.

So now I saw this while rebooting :  reboot error

Maybe it's something I don't know.

----------

## charles17

Are you sure you need or want netmount?  Otherwise, remove it. 

```
# rc-update del netmount
```

If you need it, have a look at https://wiki.gentoo.org/wiki/Network_dependent_services.

----------

## TitiTwister

Ok ok ok 

So I managed to make this driver appear on my lspci run.

But when I do a ifconfig -a still no eth0.

And when I do :

```
/etc/init.d/net.eth0 start

ERROR: interface eth0 does not exist
```

So I guess it's still something to do with my kernel but is it still the drivers ?

----------

## charles17

You should find out what the names of your network interfaces are.  That's the reason why netifrc is not recommended.

Try  *Quote:*   

> $ dmesg | grep -i 'network interface'

 

----------

## TitiTwister

 *charles17 wrote:*   

> You should find out what the names of your network interfaces are.  That's the reason why netifrc is not recommended.
> 
> Try  *Quote:*   $ dmesg | grep -i 'network interface' 

 

```
4.290763] systemd-udevd[1681]: renamed network interface eth0 to eno1677773
```

THAT MOT******* !!!   :Shocked: 

So what do I have to do now ? -_-

EDIT:

Ok so I changed the "eth0" everywhere and make a link to it.

So now it's WORKING !!! But is it good to let it this way ?

THANKS everyone you are great !!!

----------

## NeddySeagoon

TitiTwister,

Thats safe.  If you want your eth0 back, add 

```
net.ifnames=0
```

to your kernel parameters in your boot loader.

----------

