You are not logged in.
By default I am running a static-ethernet network profile, that I operate through netctl and which can ping outside too. While working on this configuration, I have disabled the profile from autostarting, so on system boot, I end up with no connection.
What I am trying to achieve here, is a simplified configuration file to be manipulated by a web-based OS configuration panel. Apparently, everything I have attempted has given me no results.
First, I tried what's specified here and there. Those appear to be the same, with the exception of first one being configured from outer resource.
/srv/conf.d/stone-roaming:
address=192.168.1.160
netmask=24
broadcast=192.168.1.255
gateway=192.168.1.254
/srv/systemd/system/stone-roaming.service:
[Unit]
Description=STONE Roaming network daemon
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-net0.device
After=sys-subsystem-net-devices-net0.device
[Service]
Type=oneshot
RemainAfterExit=true
EnvironmentFile=/etc/conf.d/stone-roaming
ExecStart=/sbin/ip link set dev net0 up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev net0
ExecStart=/bin/sh -c 'test -n ${gateway} && /sbin/ip route add default via ${gateway}'
ExecStop=/sbin/ip addr flush dev net0
ExecStop=/sbin/ip link set dev net0 down
[Install]
WantedBy=multi-user.target
Apparently, this only worked to some extent.
Execution routine:
# systemctl start stone-roaming
# systemctl status stone-roaming
stone-roaming.service - STONE Roaming network connection daemon
Loaded: loaded (/etc/systemd/system/stone-roaming.service; disabled)
Active: active (exited) since Wed 2013-07-10 12:41:39 FET; 2min 20s ago
Process: 238 ExecStart=/bin/sh -c test -n ${gateway} && /sbin/ip route add default via ${gateway} (code=exited, status=0/SUCCESS)
Process: 236 ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev net0 (code=exited, status=0/SUCCESS)
Process: 234 ExecStart=/sbin/ip link set dev net0 up (code=exited, status=0/SUCCESS)
Jul 10 12:41:39 stone systemd[1]: Started STONE Roaming network connection daemon.
Afterwards, I try to ping in the order of...
gateway:
# ping -c 3 192.168.1.254
PING 192.168.1.254 (192.168.1.254) 56(84) bytes of data.
64 bytes from 192.168.1.254: icmp_seq=1 ttl=64 time=0.299 ms
64 bytes from 192.168.1.254: icmp_seq=2 ttl=64 time=0.314 ms
64 bytes from 192.168.1.254: icmp_seq=3 ttl=64 time=0.287 ms
--- 192.168.1.254 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 1998ms
rtt min/avg/max/mdev = 0.287/0.300/0.314/0.011 ms
DNS server:
# ping -c 3 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=49 time=21.0 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=49 time=20.0 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=49 time=19.7 ms
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 19.737/20.283/21.091/0.605 ms
ISP provider:
# ping -c 3 92.63.81.4
PING 92.63.81.4 (92.63.81.4) 56(84) bytes of data.
64 bytes from 92.63.81.4: icmp_seq=1 ttl=62 time=5.08 ms
64 bytes from 92.63.81.4: icmp_seq=2 ttl=62 time=3.33 ms
64 bytes from 92.63.81.4: icmp_seq=3 ttl=62 time=4.54 ms
--- 92.63.81.4 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2002ms
rtt min/avg/max/mdev = 3.335/4.321/5.080/0.732 ms
other sites:
# ping -c 3 google.com
ping: unknown host google.com
Ah-ha! And this is where the problem relies.
In netctl profiles I can set DNS entries, hence it automatically maps to them, but in my stone-roaming.service I do not specify them, nor I do know how.
How'd I set DNS from my stone-roaming.service?
Or, if my solution or idea is wrong, then what is the way to go here?
Last edited by psycketom (2013-08-06 14:48:48)
Offline
DNS servers are listed as "nameserver ip.add.re.ss" in /etc/resolv.conf. So I imagine that you would just need something that writes that file for you.
Offline
Or you can just hardcode them there, since you're connecting to the same network every time.
Offline
I ended up with an extra bash script, that I have added to ExecStart and ExecStop respectively to manipulate the DNS servers.
@tomk, while, yes, I am connecting to the same network, the configuration can be changed from the web interface. And not only the ethernet interface values, also the nameservers.
Offline