---
# System prepended metadata

title: Ubuntu Steps For Manual Configuration. (With Netplan)

---

# Ubuntu Steps For Manual Configuration. (With Netplan)

## Netplan commands
* ```sudo netplan generate```
* ```sudo netplan apply```

## Only DHCP 

```
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp34s0:
        dhcp4: yes
```
* Run netplan commands
* Run ```ip a```
### enp34s0 :

```
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.14/24 brd 192.168.1.255 scope global dynamic noprefixroute enp34s0
       valid_lft 86234sec preferred_lft 86234sec
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever
```

Here ```192.168.1.14``` is assigned by the router

## Assigning static IP to enp34s0 adapter

```
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp34s0:
        dhcp4: no
        addresses: [192.168.1.19/24]
        gateway4: 192.168.1.1
        nameservers:
          addresses: [8.8.8.8]
```
* Run netplan commands
* Run ```ip a```
### enp34s0 : 

```
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.19/24 brd 192.168.1.255 scope global noprefixroute enp34s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever
```

Here I have assigned single static IP ```192.168.1.19``` to the adapter.

## Assigning Multiple Static IPS to enp34s0

```
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp34s0:
        dhcp4: no
        addresses: [192.168.1.19/24, 192.168.1.18/24]
        gateway4: 192.168.1.1
        nameservers:
          addresses: [8.8.8.8]
```
* Run netplan commands
* Run ```ip a```

### enp34s0 : 
```
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.19/24 brd 192.168.1.255 scope global noprefixroute enp34s0
       valid_lft forever preferred_lft forever
    inet 192.168.1.18/24 brd 192.168.1.255 scope global secondary noprefixroute enp34s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever
```
Here I have assigned ```192.168.1.18``` and ```192.168.1.19``` to the adapter.

## Assigning Multiple Static IPS to enp34s0 with DHCP enabled

```
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp34s0:
        dhcp4: yes
        addresses: [192.168.1.19/24, 192.168.1.18/24]
        gateway4: 192.168.1.1
        nameservers:
          addresses: [8.8.8.8]
```
* Run netplan commands
* Run ```ip a```

### enp34s0 : 
```
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.14/24 brd 192.168.1.255 scope global dynamic noprefixroute enp34s0
       valid_lft 86398sec preferred_lft 86398sec
    inet 192.168.1.19/24 brd 192.168.1.255 scope global secondary noprefixroute enp34s0
       valid_lft forever preferred_lft forever
    inet 192.168.1.18/24 brd 192.168.1.255 scope global secondary noprefixroute enp34s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever
```

Here I have assigned ```192.168.1.18``` and ```192.168.1.19``` to the adapter and the router assigned ```192.168.1.14```

## Bridge Network

```
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp34s0:
        dhcp4: no

  bridges:
    br0:
      interfaces: [enp34s0]
      addresses: [192.168.1.26/24]
      gateway4: 192.168.1.1
      mtu: 1500
      nameservers:
        addresses: [8.8.8.8]
      parameters:
        stp: true
        forward-delay: 4
      dhcp4: no
      dhcp6: no
```
* Run netplan commands
* Run ```ip a```

### enp34s0 : 
```
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel master br0 state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
```

### br0 : 
```
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.26/24 brd 192.168.1.255 scope global noprefixroute br0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever

```

## Re-assigning to adapter enp34s0 : 
```
# Let NetworkManager manage all devices on this system
network:
  version: 2
  renderer: NetworkManager
  ethernets:
    enp34s0:
        dhcp4: no
        addresses: [192.168.1.19/24]
        gateway4: 192.168.1.1
        nameservers:
          addresses: [8.8.8.8]
```
* Run netplan commands
* Run ```ip a```

### enp34s0 : 
```
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.19/24 brd 192.168.1.255 scope global noprefixroute enp34s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever
```

### br0 : 
```
6: br0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.26/24 brd 192.168.1.255 scope global noprefixroute br0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever

```

Although this configuration assigned ```192.168.1.19``` IP to enp34s0 but there was no internet connection.

Previously, I solved this by running ```sudo ip link delete br0 type bridge``` and then the netplan commands.

However, If I run ```sudo ip link set dev br0 down``` and then run the netplan commands again. The internet connection comes back.


### enp34s0 : 
```
2: enp34s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 2c:f0:5d:79:00:39 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.19/24 brd 192.168.1.255 scope global noprefixroute enp34s0
       valid_lft forever preferred_lft forever
    inet6 fe80::2ef0:5dff:fe79:39/64 scope link 
       valid_lft forever preferred_lft forever

```

### br0 : 
```
6: br0: <BROADCAST,MULTICAST> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.26/24 brd 192.168.1.255 scope global noprefixroute br0
       valid_lft forever preferred_lft forever
```

However, the IP is still active. Here' the router's devices map : 

![](https://i.imgur.com/6T5maqD.png)

But If I delete br0, the ip is free.

