TS-4900 Network configuration example: Difference between revisions
From embeddedTS Manuals
No edit summary |
No edit summary |
||
Line 20: | Line 20: | ||
Gateway=192.168.0.1 | Gateway=192.168.0.1 | ||
DNS=192.168.0.1 | DNS=192.168.0.1 | ||
</source> | |||
DNS will be loaded from /etc/resolv.conf. To make this use a static DNS: | |||
<source lang=bash> | |||
rm /etc/resolv.conf | |||
echo "nameserver 8.8.8.8" > /etc/resolv.conf | |||
echo "nameserver 8.8.4.4" >> /etc/resolv.conf | |||
</source> | |||
To use the DNS assigned by DHCP, run: | |||
<source lang=bash> | |||
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf | |||
</source> | </source> | ||
For more information on what options are available to configure the network, see the [http://www.freedesktop.org/software/systemd/man/systemd.network.html systemd network documentation]. | For more information on what options are available to configure the network, see the [http://www.freedesktop.org/software/systemd/man/systemd.network.html systemd network documentation]. |
Revision as of 10:11, 16 January 2018
Our Yocto image uses systemd which stores its network files in "/etc/systemd/network/". The simplest network config for a DHCP configuration would look like this:
In /etc/systemd/network/eth.network
[Match]
Name=eth*
[Network]
DHCP=yes
For a static configuration create a config file for that specific interface. /etc/systemd/network/eth0.network
[Match]
Name=eth0
[Network]
Address=192.168.0.50/24
Gateway=192.168.0.1
DNS=192.168.0.1
DNS will be loaded from /etc/resolv.conf. To make this use a static DNS:
rm /etc/resolv.conf
echo "nameserver 8.8.8.8" > /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
To use the DNS assigned by DHCP, run:
ln -s /run/systemd/resolve/resolv.conf /etc/resolv.conf
For more information on what options are available to configure the network, see the systemd network documentation.