Skip to content

NetworkingLinuxVM

Ryan Johnson edited this page Aug 18, 2020 · 3 revisions

This page is for running Ubuntu 16.04 VM's inside VMWare - it may or may not apply to other versions of Ubuntu or other VM tools.

Understanding Your Network Connections and Interfaces

Executing:

ip addr

will print out the network interfaces and their addresses that are active and operational in your Linux installation. Here is a typical result:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:6a:a9:9a brd ff:ff:ff:ff:ff:ff
    inet 192.168.52.140/24 brd 192.168.52.255 scope global ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::20c:29ff:fe6a:a99a/64 scope link 
       valid_lft forever preferred_lft forever

The interface ens33 is the interface used to get out and has the address 192.168.52.140. Interface lo is just the local loopback and will not get you connected to anything outside your machine (it will always be there).

If you just want to see the ip address of your linux, there is an even easier way to do this. Just execute:

hostname -I

Network Is Not Available

This is a problem that occurs from time to time - you go to use the network and you can't get through. So, you do a "ip addr" and it only shows one network interface like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever

A reboot always seems to fix it.

Another Possible Fix

According to this website, add the following to the file /etc/network/interfaces:

auto ens33
iface ens33 inet dhcp

This should keep the interface up.

Bringing a Network Interface Back up

But, if the above doesn't completely work, you may see the ens33 network interface down from time to time. When this happens, you don't necessarily need to reboot. You can execute the following to bring it back up:

  sudo ifup ens33

Another "ip addr" should show it up and operational.


Initially created by Brent Nelson, April 2020.