출처 : http://warmz.tistory.com/832
* 리눅스 네트워크 관련 설정파일
1) /etc/sysconfig/network-scripts/ifcfg-eth0 → 아이피,서브넷 마스크,(게이트웨이)
2) /etc/sysconfig/network → 컴퓨터이름,(게이트웨이)
3) /etc/resolv.conf → DNS 정보
4) /etc/hosts → 네임서버 파일
[root@centos ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
TYPE=Ethernet
UUID=cf810d30-f473-4707-b523-905e8bdbdc38
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=none
IPADDR=192.168.219.238
PREFIX=24
GATEWAY=192.168.219.1
DNS1=168.126.63.1
DEFROUTE=yes
IPV4_FAILURE_FATAL=yes
IPV6INIT=no
NAME="System eth0"
HWADDR=00:30:18:AD:B6:F1
[root@centos ~]# /cat/sysconfig/network
-bash: /cat/sysconfig/network: No such file or directory
[root@centos ~]# cat /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos.tanker
GATEWAY=192.168.219.1
[root@centos ~]# cat /etc/resolve.conf
cat: /etc/resolve.conf: No such file or directory
[root@centos ~]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
[root@centos ~]# service network restart
Shutting down interface eth0: [ OK ]
Shutting down loopback interface: [ OK ]
Bringing up loopback interface: [ OK ]
Bringing up interface eth0: Determining if ip address 192.168.219.238 is already in use for device eth0... [ OK ]
### 라우팅 테이블 확인 방법
[root@centos ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.219.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 1002 0 0 eth0
default 192.168.219.1 0.0.0.0 UG 0 0 0 eth0
[root@centos ~]# netstat -r
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.219.0 * 255.255.255.0 U 0 0 0 eth0
link-local * 255.255.0.0 U 0 0 0 eth0
default 192.168.219.1 0.0.0.0 UG 0 0 0 eth0
[root@centos ~]# netstat -rn
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.219.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0
0.0.0.0 192.168.219.1 0.0.0.0 UG 0 0 0 eth0
### 내/외부 PING 테스트 확인
[root@centos ~]# ping www.yahoo.com
PING ds-kr-fp3.wg1.b.yahoo.com (106.10.139.246) 56(84) bytes of data.
64 bytes from ir1.fp.vip.sg3.yahoo.com (106.10.139.246): icmp_seq=1 ttl=47 time=217 ms
64 bytes from ir1.fp.vip.sg3.yahoo.com (106.10.139.246): icmp_seq=2 ttl=47 time=216 ms
64 bytes from ir1.fp.vip.sg3.yahoo.com (106.10.139.246): icmp_seq=3 ttl=47 time=216 ms
[root@centos ~]# ping 192.168.219.1
PING 192.168.219.1 (192.168.219.1) 56(84) bytes of data.
64 bytes from 192.168.219.1: icmp_seq=1 ttl=64 time=0.520 ms
64 bytes from 192.168.219.1: icmp_seq=2 ttl=64 time=0.474 ms
64 bytes from 192.168.219.1: icmp_seq=3 ttl=64 time=0.474 ms
'구 블로그 보관처' 카테고리의 다른 글
CentOS 설치 2 - Minimal 기본 설치 후 해야 할 일들 (1/2) (0) | 2020.07.17 |
---|---|
CentOS 설치 1 - Minimal 설치 (0) | 2020.07.16 |
CentOS 파티션 분할 셋팅 (0) | 2020.07.16 |
CentOS 설치 도움 URL 정리 (0) | 2020.06.22 |
Linux - VI 명령어 사용법 정리 (0) | 2020.05.17 |
댓글