دوست من سلام لطفا برای رفع تحریم و دسترسی به تمامی ریپازیتوریها بخصوص دوستانی که در ایران هستند چاره ای جز تغییر آدرسهای دی ان اس روی سرور خود ندارند برای این منظور حتما پس از استفاده از این دی ان اس ها و نصب و راه اندازی سرویس مورد نظر حتما دوباره دی ان اس آدرسهای خود را به روت تغییر بدید و گرنه کامل قابل رهگیری هستید مثلا اگر این آدرسها رو روی مودم خودتون ست می کنید حتما موقت باشه و در اون زمان از وی پی ان استفاده نکنید چون دامنه و آی پی وی پی ان شما لو میره پس بازم میگم ازش فقط برای دسترسی موقت به ریپازیتوریها استفاده کنید موفق و سربلند باشید
Changing the DNS server on Ubuntu is an easy task but needs to be done carefully.
This article shows you how to do it easily.
Find your interface name first by:
ip addr
the result would be something like the below content:
root@trss-pisignage02-usine:/etc/netplan# ip addr
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: ens160: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:00:00:00:00:00 brd ff:ff:ff:ff:ff:ff
inet x.x.x.x/xx brd x.x.x.x scope global ens160
valid_lft forever preferred_lft forever
inet6 fe80::250:56ff:feab:2971/64 scope link
valid_lft forever preferred_lft forever
Now find the current configuration file name:
sudo ls /etc/netplan
Open the configuration file located under /etc/netplan:
sudo nano /etc/netplan/configuration.yaml #YAML stands for yet another markup language so pls be careful of syntaxes' rules
You will see something like this if your server got the IP from the DHCP:
# This is the network config written by 'subiquity'
network:
ethernets:
ens160:
dhcp4: true
nameservers:
addresses:
- y.y.y.y
- z.z.z.z
version: 2
Or maybe you will see something like this if your server has an static IP address:
# This is the network config written by 'subiquity'
network:
ethernets:
ens160:
addresses:
- x.x.x.x/xx
gateway4: x.x.x.x
nameservers:
addresses:
- y.y.y.y
- z.z.z.z
search:
- your.domain
version: 2
After that, you can save the file with your desired settings and use the below command:
To update the current network configuration safely, you can use:
By doing that if you are satisfied with your configuration you will have 2 minutes to press enter to save the configuration and if it is not correct don't worry it will revert to the previous config automatically.
sudo netplan try
And if you sure use:
sudo netplan apply
If anything goes wrong, you can add the verbose option to get more details:
sudo netplan --verbose apply
You can then use “resolvectl” again to check that the configuration has been updated:
sudo resolvectl status
On old Ubuntu versions, some other Linux distributions, or just for a temporary test, you can still edit /etc/resolv.conf to use a different DNS server.
The file content is generally really short, with generally one to three lines, including the current DNS server IP address:
Just open the file with your favorite editor to change the IP address.
sudo nano /etc/resolv.conf
By changing those addresses the server used should be updated immediately.