Guest User

Untitled

a guest
Jul 20th, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. # Configuring Static IP Addresses With Networkd
  2.  
  3. To configure a static IP address using the new NetPlan tool, the file should look like this: IPv4 address (192.168.1.2), Gateway (192.168.1.1), DNS Servers (8.8.8.8,8.8.4.4)
  4.  
  5. Run the commands below to create a new network configuration file
  6.  
  7. `sudo nano /etc/netplan/01-netcfg.yaml`
  8.  
  9. Then configure IPv4 addresses as shown below… take notes of the format the lines are written…
  10.  
  11. _This file describes the network interfaces available on your system_
  12.  
  13. _For more information, see netplan(5)._
  14.  
  15. ```yaml
  16. network:
  17. version: 2
  18. renderer: networkd
  19. ethernets:
  20. ens33:
  21. dhcp4: no
  22. dhcp6: no
  23. addresses: [192.168.1.2/24]
  24. gateway4: 192.168.1.1
  25. nameservers:
  26. addresses: [8.8.8.8,8.8.4.4]
  27. ```
  28.  
  29. Exit and save your changes by running the commands below
  30.  
  31. `sudo netplan apply`
  32.  
  33. You can add IPv6 addresses line, separated by a comma.. example below.
  34.  
  35. _This file describes the network interfaces available on your system_
  36.  
  37. _For more information, see netplan(5)._
  38.  
  39. ```yaml
  40. network:
  41. version: 2
  42. renderer: networkd
  43. ethernets:
  44. ens33:
  45. dhcp4: no
  46. dhcp6: no
  47. addresses: [192.168.1.2/24, '2001:1::2/64']
  48. gateway4: 192.168.1.1
  49. nameservers:
  50. addresses: [8.8.8.8,8.8.4.4]
  51. ```
  52.  
  53. Save your changes, apply and you’re done.
  54.  
  55. This is how to set static IP addresses on Ubuntu 18.04.
Add Comment
Please, Sign In to add comment