Ethernet
Configuring Ethernet
The Ethernet IP address of the ARTIK board is set automatically via DHCP if there is an active Ethernet cable plugged in at boot time.
This feature was not available on ARTIK 520 boards prior to rev. 0.5.
Temporary IP Address Change
If you want to change the IP address temporarily, use the ifconfig
command. Changing the IP address temporarily allows access to different networks in the same location without changing the default settings of the board.
ifconfig eth0 <new IP>
Set Static IP Address (Connection Manager)
The Connection Manager (connman
) service can be used to set a static IP address. You must be using Ubuntu, or at least Fedora 24, to do this. The following steps allow you to configure the address you want.
Have an ARTIK 520 board? Read about the MAC address before starting.
-
Connect an Ethernet-connected cable to the board.
-
Verify that the
connman
service is active. (Read about it here if not.)systemctl is-active connman
-
Get a list of available services to retrieve the Ethernet interface.
connmanctl services
You will see output similar to the following:
*AR Wired ethernet_124f5445f286_cable *AR AP-5G wifi_ec1f72d52113_496f5442697a2d3547_managed_psk
The
*Ax Wired
value is the one you're looking for. -
Configure the static IP address with following command, replacing
<*Ax Wired>
with the value you got above.connmanctl config <*Ax Wired> --ipv4 manual <Static IP Address> <Netmask> <Gateway IP Address>
For example:
connmanctl config ethernet_124f5445f286_cable --ipv4 manual 172.16.0.2 255.255.255.0 172.16.0.1
The Ethernet IP address will now remain fixed.
If you need to revert to automatic selection, you can use
connmanctl config <*Ax Wired> --ipv4 dhcp
Additional information. The commands described here create and modify a settings
file in a service-specific directory under the /var/lib/connman/
directory. You can edit settings
manually as well.
Use Fixed MAC Address for ARTIK 520
Connection Manager uses the MAC address to associate a service directory. The ARTIK 520 module on your development kit may not come with a fixed MAC address and will create a new one on every boot, which will defeat the directory association. To correct:
- Reboot and stop autoboot by pressing any key.
- Enter
run factory_set_ethaddr
- Enter
reset
The module will keep a fixed MAC address from now on.
Set Static IP Address (Network Manager)
The Network Manager service is used to configure a static IP address for systems using Fedora 22 (ARTIK 1020, and ARTIK 520 with the older Q2 image).
To change the IP address statically so that it is effective after reboot, edit the config file for that interface using your favorite text editor. This fixes the IP address of your board without allowing the board to choose your IP dynamically.
-
Open
ifcfg
file for editing usingvi
(for example).vi /etc/sysconfig/network-scripts/ifcfg-eth0
- Change
BOOTPROTO
fromdhcp
tostatic
. - Add
IPADDR
,NETMASK
,BROADCAST
,NETWORK
andGATEWAY
variables.
1 2 3 4 5 6 7 8 9 10 11 | # Generated by IoT Hub Network Manager. DEVICE="eth0" TYPE="Ethernet" ONBOOT="yes" BOOTPROTO="static" USERCTL="no" IPADDR=192.168.200.123 NETMASK=255.255.255.0 BROADCAST=192.168.200.255 NETWORK=192.168.200.0 GATEWAY=192.168.200.1 |
- Save and close the file.
-
Open the
resolv.conf
file for editing.
vi /etc/resolv.conf
- Add your DNS servers.
1 2 | nameserver <your_router_ip> nameserver 8.8.8.8 # google DNS Server |
- Save and close the file.