Setting Static IP Address¶
Setting a Static IP in the Filesystem¶
- Open /etc/network/interfaces on the MitySOM-5CSx rootfs in a text editor (vi).
- Comment out 'iface eth0 inet dhcp' by adding a '#' in front of it.
- Then add (substituting in your desired settings):
iface eth0 inet static address 192.168.1.5 netmask 255.255.255.0 network 192.168.1.0 gateway 192.168.1.254 dns-nameserver XXX.XXX.XXX.XXX
- Save the file and reboot.
Setting a Static IP from UBoot to be passed into the Kernel¶
- In UBoot you want to add your IP configuration parameters to your boot command. Currently in our case we set the dev kits to boot from mmc and use the "mmcboot" environment variable. It starts out by reading as follows:
mmcboot=setenv bootargs console=ttyS0,115200 root=${mmcroot} rw rootwait mem=512M;bootm ${loadaddr} - ${fdtaddr}
- Manually you can add in your IP settings by adding the following (ip={ ipaddr }:{ serverip }:{ gatewayip }:{ netmask }:{ hostname }:{ethX interface}:off). Here I will set the IP to 10.0.20.50, no server ip, netmask of 255.255.0.0, gateway of 10.0.0.1, no host name and the eth0 interface:
mmcboot=setenv bootargs console=ttyS0,115200 root=${mmcroot} rw rootwait mem=512M ip=10.0.20.55::10.0.0.1:255.255.0.0::eth0:off;bootm ${loadaddr} - ${fdtaddr}
- Edit your /etc/network/interfaces file so that the eth0 interface is brought up on boot but is not assigned any addressing by Linux. To do this in a default interfaces file simply comment out the "iface eth0 inet dhcp" line by adding a '#' in front of it. Ensure that the "auto eth0" line is still present. You can use a text editor such as 'vi' from the module itself to make this change.
# Wired or wireless interfaces auto eth0 #iface eth0 inet dhcp
- Reboot the module with the changes saved to the interfaces file
- During boot you will now see the command line parameters passed to the Kernel:
Kernel command line: console=ttyS0,115200 root=/dev/mmcblk0p2 rw rootwait mem=512M ip=10.0.20.55::10.0.0.1:255.255.0.0::eth0:off
and also the Ethernet interface configured with those parameters during boot:IP-Config: Complete: device=eth0, hwaddr=70:b3:d5:ef:95:dc, ipaddr=10.0.20.55, mask=255.255.0.0, gw=10.0.0.1 host=10.0.20.55, domain=, nis-domain=(none) bootserver=255.255.255.255, rootserver=255.255.255.255, rootpath=
- The result in Linux is now as follows:
root@mitysom-5csx:~# ifconfig eth0 Link encap:Ethernet HWaddr 70:b3:d5:ef:95:dc inet addr:10.0.20.55 Bcast:10.0.255.255 Mask:255.255.0.0 inet6 addr: fe80::72b3:d5ff:feef:95dc/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:502 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:39828 (38.8 KiB) TX bytes:728 (728.0 B) Interrupt:152 Base address:0x4000
Go to top