Created
October 1, 2023 07:49
-
-
Save aatizghimire/d5aec1d7445b25990167a51fdd3a58f3 to your computer and use it in GitHub Desktop.
Instruction to Set Static IP in Ubuntu in both Desktop and Server.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. Information about current Networl. | |
$ ip a | |
or | |
$ ipconfig -a | |
See the current adapter, eth0 for ethernet and wlan0 for wifi (probably). | |
Note, the Host IP, Subnet Netmask etc. | |
2. Goto /etc/netplan directory | |
$ ls | |
to find "01-network-manager-all.yaml" or similar starting with 01- and end with .yaml, if not create this file. | |
Add the Lines, if setting for ethernet (eth0): | |
network: | |
version: 2 | |
renderer: NetworkManager | |
ethernets: | |
eth0: | |
dhcp4: no | |
addresses: [172.23.207.254/20] | |
gateway4: 192.168.1.1 | |
nameservers: | |
addresses: [8.8.8.8,8.8.8.4] | |
Note: | |
addresses is ip you want to set, gateway4 is host ip. | |
you can define name server as you want, given is google's DNS nameserver. | |
3. Apply and test the changes | |
$ sudo netplan try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment