Many beginner Linux users get Linux installed on their computer or run a live Linux USB and get Linux running then can’t figure out how to connect to the internet and configure their IP address. Most Linux distributions will have this feature setup automatically to use DHCP to setup Linux IP address. Not everyone will want to use DHCP to setup their IP address, and some Linux users may not be using a Linux distribution that does have DHCP enabled automatically and those beginner Linux users will be searching the internet on how to setup IP address in Linux, how to setup DHCP in Linux, or maybe how to manually set IP address in Linux terminal. Well for all of those Linux users you will find your answers in this Linux tutorial on how to configure IP address in Linux.
How to Enable DHCP in Gnome
In the top right corner of your screen you should see your network icon. Click on your network icon and you will see a list of your devices, wired, wireless, mobile, etc. You want to click on the device you want to set DHCP on. Which should be set by default, but if for some reason your IP address is set manually in Gnome and you want to set it back to DHCP you can follow these instructions. Click on wired settings, wireless settings, etc. A new window will appear with settings. If Wi-Fi you will see a list of each access point that is available to connect to. Next to each SSID name you should see a setting icon on the right that looks like a gear. Click this gear which will bring up the settings for that device and that access point. On the left now you will see IPv4, click on this, now you will see a setting for “Addresses” and the following options: Automatic (DHCP), manual, and link-local only. Change this to Automatic (DHCP) and click apply.
How to Set IP Address Manually in Gnome
This is under the same section as enabling DHCP in Gnome if you read that above, if not, just continue reading. In the top right corner of your screen you will see a network icon. Click on the network icon and you should see a list of your devices, both wired and wireless. You want to click on the device you want to manually configure the IP address for. DHCP should be set by default. Click on wired settings, wireless settings, etc. A new window will appear with settings. If Wi-Fi you will see a list of each access point that is available to connect to. Next to each SSID name you should see a setting icon on the right that looks like a gear. Click this gear which will bring up the settings for that device and that access point. On the left now you will see IPv4, click on this, now you will see a setting for “Addresses” and the following options: Automatic (DHCP), manual, and link-local only. Change this to manual, now you will be shown a form to enter: Address, Netmask, and Gateway. Enter your IP address in the address box, enter your netmask, and gateway and click apply. Your device should now have it’s IP address set manually.
How to Enable DHCP in Linux Terminal
- First you will want to open a Linux terminal
- Login as root user by typing
su
and entering your root password, or addsudo
in front of each of the following commands, examplesudo ifconfig -a
- Find what the device name is of your network interface
ifconfig -a
- Look for a device name similar to
eth0
orwlan0
, yours may even be different depending on what Linux kernel and modules are loaded
- Now use
dhcpcd
ordhclient
to change the network device’s IP addressdhcpcd eth0
ordhclient eth0
replaceeth0
with the name of your network device
- Your DHCP client will get an IP address assigned to your network interface, you may now exit your Linux terminal
How to Set IP Address Manually in Linux Terminal
- Open a Linux terminal
- Login as root user by typing
su
and then entering your root password, or you can addsudo
in front of each command, example:sudo ifconfig -a
- Find what the device name is of your network interface you are wanting to change your IP address of.
ifconfig -a
- Look for a device name similar to
eth0
orwlan0
, yours may even be different depending on what Linux kernel and modules are loaded.
- Now you will use
ifconfig
to set the IP address of your Linux computer.ifconfig [device-name] [ip-address]
- So if I want to change
eth0
to192.168.0.3
I would do:ifconfig eth0 192.168.0.3