Skip to main content
Question

How to configure internet access to ubuntu server?

  • Aug 23, 2022 10:05 AM UTC
  • 3 replies
  • 2380 views

Forum|alt.badge.img+2
  • Do Gooder (Employee)

My remote cloud customer would like to configure not dhcp address but the static ip address to Ubuntu Linux box

How this can be done? 

Also that connection should recognize all the names like www.google.fi when you use pinging only a name

Br

Simo Kallio

 

3 replies

Forum|alt.badge.img+21
  • Superhero (Employee)
  • Aug 24, 2022 12:01 AM UTC

Hi @SimoK ,

Name resolution will be done by the DNS server you setup in your static IP config.
 

To set a static IP, you would need delete all existing yaml files except for the 01-netcfg.yaml and make your changes in there. 

Steps are below,
1.    cd /etc/netplan
2.    Delete all XX-netcfg.yaml files except 01-netcfg.yaml
3.    vi /etc/netplan/01-netcfg.yaml
4.    Copy the sample below.
5.    Update for correct IP and Gateway address
6.    Save
7.    Run “netplan apply”


Sample:
network:
  version: 2
  ethernets:
    eth0:
      dhcp4: false
      addresses:
      - <Server ADDR>/24
      gateway4: <Gateway ADDR for VLAN>
      nameservers:
       addresses:
       - <DNS IP Addr>
       search:
       - <Search Domain>

 

Cheers


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Employee)
  • Aug 31, 2022 8:48 AM UTC

What this means? No matter what ever DNS server address i give it says the same invalid YAML error


root@ifstestcloud01:/etc/netplan# nano 01-netcfg.yaml
root@ifstestcloud01:/etc/netplan# sudo netplan apply
/etc/netplan/01-netcfg.yaml:10:1: Invalid YAML: tabs are not allowed for indent:
        addresses: [10.20.10.2, 10.20.10.11]
^
root@ifstestcloud01:/etc/netplan# nano 01-netcfg.yaml
root@ifstestcloud01:/etc/netplan# sudo netplan apply
/etc/netplan/01-netcfg.yaml:10:1: Invalid YAML: tabs are not allowed for indent:
        addresses: [10.20.10.11]
^
root@ifstestcloud01:/etc/netplan# ^C
root@ifstestcloud01:/etc/netplan# nano 01-netcfg.yaml
root@ifstestcloud01:/etc/netplan# sudo netplan apply
/etc/netplan/01-netcfg.yaml:10:1: Invalid YAML: tabs are not allowed for indent:
        addresses: [8.8.8.8. 8.8.4.4]
^
root@ifstestcloud01:/etc/netplan# cat 01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses: [10.20.14.29/24]
      gateway4: 10.20.14.1
      nameservers:
        addresses: [8.8.8.8. 8.8.4.4]
        search: [insta.fi]
 


Forum|alt.badge.img+2
  • Author
  • Do Gooder (Employee)
  • Aug 31, 2022 10:52 AM UTC

Hi

There was some trash in the 01-netcfg.yaml file. I open the vi editor and did go all the lines true one by one. Then apply command worked

br

Simo Kallio