Hi.
I'm running an image (Yocto) on a SabreSD board and wonder how I change from DCHP client mode to static mode, when it comes to setting the network port?
How do I a turn on/off DHCP from the command line?
Also, how do I change the MAC address?
Thanks,
Niklas
To disable DHCP, please remove it(ip=dhcp) in uboot command line;
To use a static IP, you can use ifconfig command such as:
ifconfig eth0 10.192.242.117
To change MAC address, you can use below command in commandline:
fec.macaddr=0x00,0x10,0x20,0x30,0x40,0x88
Hi Yongcai.
This means that I can only run the image with either DCHP on or off.
In our case we want to be able to change it dynamically, when the Linux image is running.
I found in /etc/networking/interfaces that I think I should be able to change this setting.
As for MAC address it can be permanently changed by burning e-fuse.
Alternatively you can add the command like this
ifconfig eth0 hw ether 00:04:9f:00:e9:bb
into init script of the system to overwrite the value.
The better way to configure eth0 for a static IP address, rather than dhcp, is like this in the /etc/network/interfaces file:
# Wired or wireless interfaces
auto eth0
#iface eth0 inet dhcp
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
gateway 192.168.0.1
There is a good tutorial here:
https://www.howtoforge.com/tutorial/howto-set-a-static-ip-on-ubuntu/
Regards, Clay