AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Check ethernet status on ubuntu via terminal12/29/2023 You might have noticed a line that says 'ethernet' and our network interface name under that. Running this command shows that the file I am looking for is '00-installer-config.yaml'. Since the name of network interface for my ethernet is 'enp1s0', I will run the following command: $ grep -iH enp1s0 *.* Use the following command if you are not comfortable with grep: grep -H INTERFACE_NAME *.* When in doubt, grep for the name of your network interface. It is better if there is one file (easier to know which one to edit), but in some cases, there might also be more than one files with the extension '.yml' or '.yaml'. Once the 'cloud-init' related configuration is complete, we must now edit the netplan configuration to add our static IP address. Please reboot now so that cloud-init does not interfere when we set our static IP address in the next step. sudoedit /etc/cloud//99-disable-cloud-init.cfgĪdd the following line to it: network: The name does not matter, so I will call it '99-disable-cloud-init.cfg'. ![]() ![]() Now, to disable could-init, create a new file inside the /etc/cloud/ directory. If you get an outupt, you have 'cloud-init' installed. Run the following command to check: apt-cache pkgnames | grep cloud-init The easiest way to know if cloud-init is present or not is to check if there is a package with that name. Now that you have detail like interface name and gateway address, it is time to edit a config file. On the line that starts with "default via", I can see that my gateway address '192.168.122.1' The gateway address will be on the line that begins with "default via".īelow is the output of running the ip command on my computer: $ ip routeĭefault via 192.168.122.1 dev enp1s0 proto staticġ92.168.122.0/24 dev enp1s0 proto kernel scope link src 192.168.122.69 To know the address of your gateway, run the following command: ip route Step 3: See the gatewayĪ gateway is a device that connects different networks (basically what your all-in-one router is). Nice! But let's change it to '192.168.122.128' for demonstration purposes. Now that you know which interface needs to be addressed let us edit a file.īefore I change my IP address/set a static one, let us first see what my current IP address is. I can make out that my ethernet interface is named 'enp1s0'. Here is what it looks like on my computer: $ nmcli device statusĮnp1s0 ethernet connected Wired connection 1 That will give you the device name, type, state and connection status. Run the following command to view the available network interfaces: nmcli device status The advantage (at least in my opinion) of having Ubuntu Desktop is having NetworkManager as the renderer for netplan. The output enumerates network interfaces with numbers.įrom this, I can see that the ethernet interface is 'enp1s0'. To see available network interfaces on Ubuntu Server, run the following command: ip linkĭoing so will show a similar result: $ ip linkġ: lo: mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000 Ubuntu Server and Ubuntu Desktop use different renderers for 'netplan', they are 'systemd-networkd' and 'NetworkManager', respectively. ![]() This means your one and only ethernet interface will not be named 'eth0'. That is because since Ubuntu 20.04, the network interfaces are named using predictable network interface names. The first step is always to know the name of your network interface. Step 1: Identify the correct network interface You need to set a static IP address on your Ubuntu system to avoid problems. This could cause a problem if you have a home lab or server setup that works on a fixed IP address. The DHCP server may also give you a new IP address occasionally. Normally, the router's DHCP server handles assigning the IP address to every device on the network, including your computer.
0 Comments
Read More
Leave a Reply. |