You are not logged in.

#1 2013-10-06 14:52:19

geekinthesticks
Member
From: England
Registered: 2011-09-21
Posts: 143
Website

[solved] netctl Interface Won't Come Up If Gateway Doesn't Exist.

I think this is probably designed to work this way, but I would appreciate suggestions for a workaround. I am using a raspberrypi as a router. The Ethernet interface is configured as static:

Description='A basic static ethernet connection'
Interface=eth0
Connection=ethernet
IP=static
Address=('192.168.0.2/24')
Gateway='10.0.0.1'
DNS=('192.168.0.2')

The second interface is an Android phone on usb0

Description='A basic dhcp Android tethering'
Interface=usb0
Connection=ethernet
IP=static
Address=('10.0.0.1/24')
Gateway='10.0.0.1'
DNS=('10.0.0.1')

However, the usb interface won't initialize until I press the "USB tethering" checkbox on the phone, so it doesn't exist when eth0 is initialized. Because eth0 can't find the default gateway, it won't come up. So is there any way of initialising eth0, even if the gateway doesn't yet exist.

Last edited by geekinthesticks (2013-10-11 08:45:32)

Offline

#2 2013-10-06 17:13:30

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [solved] netctl Interface Won't Come Up If Gateway Doesn't Exist.

Your netctl pofiles are wrong. First, 'usb0' has an IP address which is the same as the gateway. That's not a good idea. Second, the LAN interface 'eth0' is not supposed to have a gateway/DNS at all. So, I'd remove both gateways for starters. I also don't understand your choice of a DNS server.

I _think_ what you are trying to accomplish is to use the phone's data capability to get internet access, and then route the traffic through the Pi's kernel to eth0 which is connected to a switch. Is that right?


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#3 2013-10-07 07:35:29

geekinthesticks
Member
From: England
Registered: 2011-09-21
Posts: 143
Website

Re: [solved] netctl Interface Won't Come Up If Gateway Doesn't Exist.

I'll try and explain what I want to do. At the moment I have a box (the firewall) that has two ethernet cards. One ethernet card is connected to the local LAN and the other card is connected to an ADSL line via a usb modem, which appears as interface ppp0. I use Shorewall as a firewall to manage traffic between the local LAN and the Internet. The firewall box also has a DNS server, which manages DNS for the local network and a DHCP server.

My ADSL connection manages 3MBits down and about 256k up on a good day. However I can use  the Three mobile network, which will give me about 10Mbits down and 5MBits up. I can get an "All you can eat" data plan for less than half the cost of my ADSL. However, I have to us a phone SIM - 3g dongles and MiFi won't work. So what I am trying to do is to replace my ADSL connection (ppp0) with the tethered phone (usb0).

The RaspberryPi is a "Proof of concept" box to make sure I can e eh system to work, before transitioning over my main server.

Offline

#4 2013-10-09 18:19:20

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [solved] netctl Interface Won't Come Up If Gateway Doesn't Exist.

Sorry for not replying earlier...

Are you saying that the netctl config which you showed before is the same one
you are currently using on the router? The reason I'm asking is because that config is
really odd.

Here's what I'd do (assuming eth0 is the LAN interface and a dhcp/dns server
listening on it):

1. Create a netctl profile for eth0

Description="LAN connection"
Connection=ehternet
Interface=eth0
SkipNoCarrier="yes"  <--- Important if you don't always have cable plugged in
IP=static
Address=(192.168.0.2/24)

The clients connecting to eth0 will have a default gateway 192.168.0.2 (is
there a reason why 192.168.0.1 is unavailable?) which will also serve as their
primary DNS server. These settings should be advertised by your dhcp server (at
least that's what my dnsmasq does).

2. For usb0 (you can create a udev rule to rename usb0 -> ppp0 to keep as much
of your current firewall config as possible), make a profile with either static
or dynamic IP (I don't know how you do the tethering). If the IP is static,
make sure that gateway is correct.

3. Finally, decide on the DNS. Either specify a DNS server in the usb0 profile
via DNS=(), in which case openresolv should take care of /etc/resolv.conf
(however, I never used this option, so I _hope_ this is true). I would
personally go with a static resolv.conf using either Google DNS, OpenDNS, or
Comodo SecureDNS. For a static nameserver config, don't use the DNS=() option.

Last edited by Leonid.I (2013-10-09 18:19:50)


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

#5 2013-10-11 08:44:59

geekinthesticks
Member
From: England
Registered: 2011-09-21
Posts: 143
Website

Re: [solved] netctl Interface Won't Come Up If Gateway Doesn't Exist.

Thanks for the considered reply. The reason for the strange setup is I am trying to experiment with the new system without disrupting the current working system. I have now got the basic system working. Removing the gateway from eth0 solved the problem. I now have bind and dhcp running on the Pi and they serve DNS for the local network. Everything else is forwarded to OpenDNS servers. Shorewall takes care of the firewall and routing traffic to/from the Internet on usb0. The only remaining problem is Adroid won't enable usb tethering by default. Thus the usb0 interface won't get an ip address when the system is first started. I have to manually click the Tether checkbox on the phone, then restart the usb0 interface. However, I may be able to find a workaround for this using Tasker on the Android phone.

Offline

#6 2013-10-14 22:12:50

Leonid.I
Member
From: Aethyr
Registered: 2009-03-22
Posts: 999

Re: [solved] netctl Interface Won't Come Up If Gateway Doesn't Exist.

geekinthesticks wrote:

Thanks for the considered reply. The reason for the strange setup is I am trying to experiment with the new system without disrupting the current working system. I have now got the basic system working. Removing the gateway from eth0 solved the problem. I now have bind and dhcp running on the Pi and they serve DNS for the local network. Everything else is forwarded to OpenDNS servers. Shorewall takes care of the firewall and routing traffic to/from the Internet on usb0. The only remaining problem is Adroid won't enable usb tethering by default. Thus the usb0 interface won't get an ip address when the system is first started. I have to manually click the Tether checkbox on the phone, then restart the usb0 interface. However, I may be able to find a workaround for this using Tasker on the Android phone.

So, you don't have usb0 before you enable tethering? If that's the case, try to order the netctl profile (actually, the corresponding unit in /etc/systemd/system) after usb0 device, see e.g. https://lists.fedoraproject.org/piperma … 60917.html
(except you can probably skip the udev rule, but check "udevadm info --path=/sys/class/net/usb0 | grep TAG").


Arch Linux is more than just GNU/Linux -- it's an adventure
pkill -9 systemd

Offline

Board footer

Powered by FluxBB