| Title | TLBB Cài đặt mạng cho Ubuntu |
| Permission | rw-r--r-- |
| Author | Unknown |
| Date and Time | 7:39:00 PM |
| Category | linux| tlbb |
| Share |
Mở tệp interfaces ra để chỉnh sửa:
- sudo nano /etc/network/interfaces
auto eth0 #thường là eth0 có thể là eth1, eth2
iface eth0 inet static
address 192.168.1.x #địa chỉ ip bạn chọn
netmask 255.255.255.0
gateway 192.168.1.1
Sau đó lưu lại và khởi động lại mạng:- sudo /etc/init.d/networking restart
Mở tệp resolv.conf:
- sudo gedit /etc/resolv.conf
nameserver 8.8.8.8
- echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
Nếu DNS file tự động reconfig thì làm như sau:
- sudo nano /etc/resolvconf/resolv.conf.d/head
(ignore the scary warning. /etc/resolv.conf is autogenerated, so the warning is there so it will get put in /etc/resolv.conf when /etc/resolv.conf is generated.) To the end of the file, add
nameserver <ip_of_nameserver>
Press Ctrl x and answer yes to saving the file. To finish up, regenerate /etc/resolv.conf so the changes are applied right now:
- sudo resolvconf -u
Edit /etc/hostname and change to the new value, you can use nano instead of vi, but remember that real men prefer vi.
- vi /etc/hostname
Edit /etc/hosts and change the old 127.0.1.1 line to your new hostname (if you dont do this, you wont be able to use sudo anymore. If you hav e already done it, press ESC on the grub menu, choose recovery, and edit your host file to the correct settings)
127.0.0.1 localhost
127.0.1.1 ubuntu.local ubuntu # change to your new hostname/fqdn
127.0.1.1 ubuntu.local ubuntu # change to your new hostname/fqdn
Now after a reboot, your hostname will be the new one you chose. To change without a reboot, you can just use hostname.sh after you edit /etc/hostname:
- sudo /etc/init.d/hostname.sh start
