Contents:
Bài viết này sẽ hướng dẫn các bạn cấu hình IP tĩnh, DNS server và Hostname trên Ubuntu các phiên bản.
Thực hiện lệnh:
sudo nano /etc/network/interfaces
Đối với Ubuntu phiên bản cũ bạn sẽ thấy tương tự như sau:
auto lo eth0 iface lo inet loopback iface eth0 inet dynamic
Còn đối với Ubuntu 16.04 trở lên thì sẽ như sau:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # The primary network interface auto ens33 iface ens33 inet dhcp
Đối với phiên bản cũ bạn chỉnh sửa như sau:
auto lo eth0 iface lo inet loopback iface eth0 inet static address 192.168.1.100 netmask 255.255.255.0 gateway 192.168.1.1
Đối với Ubuntu 16.04 trở lên:
# This file describes the network interfaces available on your system # and how to activate them. For more information, see interfaces(5). source /etc/network/interfaces.d/* # The loopback network interface auto lo iface lo inet loopback # test # The primary network interface auto ens33 iface ens33 inet static address 192.168.1.100 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255 gateway 192.168.1.1 dns-nameservers 8.8.8.8 8.8.4.4
[quangcao1]
sudo nano /etc/resolv.conf
Thay đổi DNS Server, sau đây là ví dụ cho google dns:
nameserver 8.8.8.8 nameserver 8.8.4.4
Đối với Ubuntu >14.04
sudo nano /etc/network/interfaces
Thêm dòng dns-nameservers vào cuối file
auto lo iface lo inet loopback iface ens33 inet static address xxx.xxx.xxx.xxx(enter your ip here) netmask xxx.xxx.xxx.xxx gateway xxx.xxx.xxx.xxx(enter gateway ip here,usually the address of the router) dns-nameservers 8.8.8.8
sudo /etc/init.d/networking restart
Đối với Ubuntu >14.04
systemctl restart ifup@eth0
ifconfig
Kết quả đúng trả về như sau:
eth0 Link encap:Ethernet direcciónHW 00:33:27:46:2v:34
Direc. inet:192.168.1.101 Difus.:0.0.0.0 Másc:255.255.255.0
…
sudo nano /etc/hostname
Ví dụ đặt tên hostname là itfromzero
itfromzero
Lưu file và khởi động lại máy để các cấu hình được thay đổi nhé bạn.
Như các bạn đã biết thì Telegram là một dịch vụ tin nhắn tuyệt vời…
Apache Tomcat là gì? Apache Tomcat là một web server HTTP được phát triển bởi…
20 triệu có lẽ là một mức chi phí khá lý tưởng cho một máy…
Micosoft chính thức phát hành Microsoft Edge Chromium Microsoft đã chính thức tung ra trình…
CentOS 8 đã phát hành ngày 25/09/2019, phiên bản 8 lần này có những thay đổi…
Thời buổi công nghệ phát triển, phần lớn công việc của con người đều có…
Leave a Comment