# Set up network on home headless server

## paul_chany

Hi,

I have a headless server. This is a power pc box.

I can install on it Gentoo linux by using live-USB.

https://github.com/sakaki-/gentoo-on-b2

I'm stuck with network setup. I can't even set network with live-USB too.

I red Gentoo Handbook and search Gentoo Forum for solution, but none them help me out.

Relevant information of my setup follows.

/etc/conf.d/net

```
config_eth0="dhcp"

config_eth1="dhcp"
```

eth0 is for WAN, eth1 is for LAN.

This headless powerpc box is connected to my cable modem; the cable modem is connected to my ISP. The powerpc box get it's IP address dynamically on eth0, that is, eth0 has not a static IP address.

/etc/resolv.conf

```
nameserver 91.102.231.242

nameserver 91.102.231.241
```

/etc/dhcpcd.conf

```
hostname

duid

persistent

option rapid_commit

option domain_name_servers, domain_name, domain_search, host_name               

option classless_static_routes

option ntp_servers

require dhcp_server_identifier

slaac private

nohook lookup-hostname

timeout 30
```

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

```
ping google.com
```

ping: unknown host google.com

```
ping 8.8.8.8
```

connect: Network is unreachable

```
route -n 
```

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

127.0.0.0         0.0.0.0          255.0.0.0            U       0         0         0     lo

169.254.0.0     0.0.0.0         255.255.0.0       U        2         0         0     eth0

I tried also:

```
route add default gw 169.254.0.0 eth0
```

On this powerpc box I have run previously Debian Jessie and on it I can to set networking.

But here, with Gentoo, I don't know what should I do to solve this problem?

Regards,

Paul Chany

----------

## NeddySeagoon

paul_chany,

You are probably having issues with 'persistant interface naming,

eth0 and eth1 will be the kernal names for your interfaces.

dmesg will show them being renamed by udev.

You will either need to use the  'persistant names', os turn off persistant names and use the kernel names.

```
ifconfig -a
```

will show the interface names.

-- edit --

Hmm, your routing table shows that the above is not correct.

eth0 is listed but not eth1

eth0 has a link local address, which is a self assigned IP address, when a dhcp server cannot be reached.

----------

## paul_chany

 *NeddySeagoon wrote:*   

> paul_chany,
> 
> You are probably having issues with 'persistant interface naming,
> 
> eth0 and eth1 will be the kernal names for your interfaces.
> ...

 

I installed once again Gentoo on this headless server.

Now when I run ifconfig, I get:

```
ifconfig -a
```

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

        inet 169.254.55.235  netmask 255.255.0.0  broadcast 169.254.255.255

        inet6 fe80::222:2ff:fe00:73c  prefixlen 64  scopeid 0x20<link>

        ether 00:22:02:00:07:3c  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 17  bytes 2226 (2.1 KiB)

        TX errors 17  dropped 0 overruns 0  carrier 0  collisions 0

eth1: flags=4098<BROADCAST,MULTICAST>  mtu 1500

        ether 00:22:02:00:07:3d  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

        device base 0x2000  

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 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

When I'm using my desktop Arch linux, connected to my cable modem ( that is connected to my ISP ), I have the following route table:

```
# ip route
```

default via 95.85.171.254 dev enp0s20  metric 202 

default via 95.85.171.254 dev enp0s20  proto dhcp  src 95.85.170.202  metric 1024 

95.85.170.0/23 dev enp0s20  proto kernel  scope link  src 95.85.170.202 

95.85.170.0/23 dev enp0s20  proto kernel  scope link  src 95.85.170.202  metric 202 

95.85.171.254 dev enp0s20  proto dhcp  scope link  src 95.85.170.202  metric 1024

So I try to run on my Gentoo system the command:

```
route add default gw 95.85.171.254 eth0
```

SIOCADDRT: Network is unreachable

So I can't run this command. Why?

```
lspci
```

00:00.0 Power PC: Freescale Semiconductor Inc Device 00b0 (rev 10)

00:10.0 Mass storage controller: Silicon Image, Inc. SiI 3114 [SATALink/SATARaid] Serial ATA Controller (rev 02)

There is no messages about any Ethernet hardware?!

But when I had running on this headless server a Debian Jessie system, eth0 and eth1 works fine.

----------

## NeddySeagoon

paul_chany,

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

inet 169.254.55.235 netmask 255.255.0.0 broadcast 169.254.255.255

inet6 fe80::222:2ff:fe00:73c prefixlen 64 scopeid 0x20<link> 

ether 00:22:02:00:07:3c txqueuelen 1000 (Ethernet) 
```

Shows that eth0 is up and has a self assigned link local IP address for both IPv4 and IPv6

```
eth1: flags=4098<BROADCAST,MULTICAST> mtu 1500

ether 00:22:02:00:07:3d txqueuelen 1000 (Ethernet) 
```

shows that eth1 is not up as the inet and inet6 lines are missing.

dhcpcd assigns a link local IPv4 address when its unable to reach a dhcp server.

This possibly means that your eth0 and eth1 are swapped over.  Indeed, they may swap over randomly every boot.

eth1 is probably not up as its not in /etc/init.d

The 169.254.0.0/16 subnet is not routable.  Its designated for use in local networks without a router.

Think lan party or ad hoc wireless networking.

Your ethernet harhware is definately working and your kernel driver is loaded too.  The interfaces appear it ifconfig -a.

You have a configuration issue, not an installation issue, reinstalling won't help.

You could switch to persistant net names but as a first step, I would connect the LAN to the other network port and restart networking.

----------

## paul_chany

 *NeddySeagoon wrote:*   

> 
> 
> You could switch to persistant net names but as a first step, I would connect the LAN to the other network port and restart networking.

 

The 'diagram' of my home network is:

...cable modem that is connected to My Internet Service Provider

...|

...--- Bubba 2's WAN port ( eth0 )

.......|

.......--- Bubba 2's LAN port ( eth1 )

...........|

...........--- Switch

................|

................--- my Desktop Arch linux system

................|

................--- my laptop with Arch linux system

eth0 on Bubba2 should get it's dynamic IP address from my ISP.

Well, after I set eth1 in /etc/conf.d/net:

```
# WAN connection: direct to my cable modem

# that is connected to my ISP's server on which

# ISP's dhcpd server gives dynamic IP address for

# my Bubba2 ( B2 )'s eth0

#config_eth0="dhcp"

# LAN: my B2's eth1 is connected to a Switch and other

# home computers are connected to this Switch too

config_eth1="192.168.10.1 netmask 255.255.255.0 brd 192.168.10.254"                                 

routes_eth1="default via 192.168.10.1"
```

and run 

```
/etc/init.c/net.eth1 start
```

 * Bringing up interface eth1

my serial console connection freezes.

Moreover I can't ssh into my B2.

When I connect my Desktop Arch linux system directly to cable modem and have connected to the Internet, then I have following network setup:

```
ip addr
```

2: enp0s20: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000

    link/ether 00:1a:92:ce:61:70 brd ff:ff:ff:ff:ff:ff

    inet 95.85.171.243/23 brd 95.85.171.255 scope global enp0s20

       valid_lft forever preferred_lft forever

    inet6 fe80::1c05:5ccd:24e4:25a6/64 scope link 

       valid_lft forever preferred_lft forever

```
ip route
```

default via 95.85.171.254 dev enp0s20  metric 202 

95.85.170.0/23 dev enp0s20  proto kernel  scope link  src 95.85.171.243  metric 202 

95.85.171.254 dev enp0s20  proto dhcp  scope link  src 95.85.171.243  metric 1024

So I'm stuck here. What can I do further to solve my problem?

----------

## NeddySeagoon

paul_chany,

Are there any hints in dmesg?

----------

## Buffoon

I could help if you put your .config into pastebin, there may be something missing in kernel.

----------

## paul_chany

 *NeddySeagoon wrote:*   

> paul_chany,
> 
> Are there any hints in dmesg?

 

[ 1924.731845] fsl-gianfar e0024000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

[ 2008.836467] fsl-gianfar e0024000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

[ 2118.647292] fsl-gianfar e0024000.ethernet eth0: Link is Up - 1Gbps/Full - flow control rx/tx

[ 2308.938334] fsl-gianfar e0024000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

[ 2394.828981] fsl-gianfar e0024000.ethernet eth0: Link is Up - 100Mbps/Full - flow control rx/tx

----------

## paul_chany

 *Buffoon wrote:*   

> I could help if you put your .config into pastebin, there may be something missing in kernel.

 

```
mount /boot/

cd /boot/boot/
```

There are files:

System.map  bubba.dtb  config  uImage .

Pastebin of 'config' file is here:

http://paste2.org/B4NUzc0C

----------

## krinn

This is explain here: https://wiki.gentoo.org/wiki/Network_bridge

----------

## paul_chany

A have solved the problem with help of the author of gentoo-on-b2.

( See one of my previous if not the first post in this thread! )

----------

