Quick Answer: How to Assign Ip Address in Linux Command Line?
Contents

How to Manually Set Your IP in Linux (including ip/netplan)

  • Set Your IP Address. ifconfig eth0 192.168.1.5 netmask 255.255.255.0 up.
  • Set Your Default Gateway. route add default gw 192.168.1.1.
  • Set Your DNS Server. Yes, 1.1.1.1 is a real DNS resolver by CloudFlare. echo “nameserver 1.1.1.1” > /etc/resolv.conf.

How do I permanently assign an IP address in Linux?

2. Change ip-address Permanently. Under the /etc/sysconfig/network-scripts directory, you’ll see file for every network interface on your system.

How assign IP address to ifconfig in Linux?

To get started, type ifconfig at the terminal prompt, and then hit Enter. This command lists all network interfaces on the system, so take note of the name of the interface for which you want to change the IP address.

James H. Sterling

James H. Sterling

Environmental Science & Climate Journalist

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.

Share this article
Twitter Facebook Pinterest