Ubuntu의 경우, network manager 패키지에 설정된 것이 우선권을 가진다고 한다.
/etc/network/interface
나 /etc/resolv.conf
를 직접해도 적용이 안되면 위의 내용 때문일 확률이 높다.
Configuring DHCP address for your network card
If you want to configure DHCP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card
sudo vi /etc/network/interfaces
다음과 같이 편집.
# The primary network interface - use DHCP to find our address
auto eth0
iface eth0 inet dhcp
Configuring Static IP address for your network card
If you want to configure Static IP address you need to edit the /etc/network/interfaces and you need to enter the following lines replace eth0 with your network interface card
sudo vi /etc/network/interfaces
다음과 같이 편집.
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.3.90
gateway 192.168.3.1
netmask 255.255.255.0
network 192.168.3.0
broadcast 192.168.3.255
# Setting for the domain name system server
dns-nameserver 168.126.63.1 168.126.63.2 8.8.8.8
반드시 설정 변경 이후 netwowrk를 재시작하자.
After entering all the details you need to restart networking services using the following command
sudo /etc/init.d/networking restart
Setting up DNS
Ubuntu의 경우 가급적 /etc/network/interface 에 DNS server를 설정하는 게 좋다.
https://blueprints.launchpad.net/ubuntu/+spec/foundations-p-dns-resolving
위 링크에서 따르면 Ubuntu에서 /etc/resolv.conf의 관리를 resolveconf로 변경되었고, resolveconf로 인해 수동편집으로 바꿔봐야 resolveconf가 덮어쓴다. 즉, resolveconf를 사용해야 한다.
/etc/resolv/conf 수정으로 충분한 경우만 아래를 참고.
When it comes to DNS setup Ubuntu doesn’t differ from other distributions. You can add hostname and IP addresses to the file /etc/hosts for static lookups.
To cause your machine to consult with a particular server for name lookups you simply add their addresses to /etc/resolv.conf.
For example a machine which should perform lookups from the DNS server at IP address 192.168.3.2 would have a resolv.conf file looking like this
sudo vi /etc/resolv.conf
다음과 같이 편집.
search test.com
nameserver 192.168.3.2
References
'Computer > Linux' 카테고리의 다른 글
[vim] VI : carriage return 제거하기 : CRLF → LF (0) | 2023.07.14 |
---|---|
[Linux] vi (or vim) 사용법 정리 (0) | 2023.03.21 |
[Linux] 화면 캡쳐 단축키 (0) | 2023.01.30 |
[Linux] Debian 계열 패키지 관리 툴: apt, apt-get (0) | 2023.01.26 |
[Linux] Nano Editor 간단 사용법 (0) | 2023.01.10 |