Instantly assign static IP address in embedded Linux

1

Is there some basic Linux way to assign a static IP address without writing some files, just for the current session until reboot?

Paul

Posted 2017-06-06T13:18:23.233

Reputation: 579

Answers

1

IIUC, you can do that with ifconfig tool. Most Linux-based systems come with ifconfig by default. Usage:

ifconfig <interface> <IP>

Example:

 ifconfig eth0 192.168.100.100

Arkadiusz Drabczyk

Posted 2017-06-06T13:18:23.233

Reputation: 1 776

1

Just for completeness: ifconfig has been superseded by ip. ip has more functionality, a cleaner syntax, and it's easier to parse the output in scripts.

Assuming you want to add a /24 address on eth0, use:

ip addr add 192.168.100.100/24 dev eth0

Just

ip addr

will show the assigned addresses for all interfaces.

dirkt

Posted 2017-06-06T13:18:23.233

Reputation: 11 627