LINUX

리눅스 네트워크 잡기

지니 2017. 3. 23. 15:24
반응형




ping www.google.co.kr 을 했더니 , ping: unknown host www.google.co.kr 


이 나왓다. 뭔가 네트워크 설정이 제대로 안되어서 이런문제가 생긴듯하다.


1.  vi /etc/sysconfig/network-scripts/ifcfg-eth0  파일 열기 

 (ifcfg-eno1 일 수도 있다.) 




DEVICE=eth0

TYPE=Ethernet

UUID=a89ea4c3-ae10-4999-93aa-51b790a0abe3

NM_CONTROLLED=yes

BOOTPROTO=static

ONBOOT=yes

IPADDR= 서버 아이피

GATEWAY= 게이트웨이

NETMASK= 넷마스크

HWADDR=00:1F:29:32:24:BC



이런식으로 알맞게 설정해준다.

2. /etc/init.d/network restart // 네트워크 리스타트를 해준다.

다시 ping 을 때려봣다 , 여전히 안된다.


3. vi /etc/resolv.conf  파일을 연다.


nameserver  222.1111.3333.444 // 각자의 네임서버 (DNS) 에 맞게 넣어준다.



4.    /etc/init.d/network restart  // 네트워크 리스타트


다시 ping 을 때려봣다. 


해결되었다.




아래 로그중 붉은 글씨를 보고 참고하면 될듯핟다.










======================================================


[root@server105 ~]# ping www.google.co.kr

ping: unknown host www.google.co.kr

[root@server105 ~]# ping www.google.co.kr

ping: unknown host www.google.co.kr

[root@server105 ~]# vi /etc/sysconfig/network-scripts/ifcfg-

ifcfg-eth0  ifcfg-eth1  ifcfg-lo    

[root@server105 ~]# vi /etc/sysconfig/network-scripts/ifcfg-

ifcfg-eth0  ifcfg-eth1  ifcfg-lo    

[root@server105 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0




DEVICE=eth0

TYPE=Ethernet

UUID=a89ea4c3-ae10-4999-93aa-51b790a0abe3

NM_CONTROLLED=yes

BOOTPROTO=static

ONBOOT=yes

IPADDR= 서버 아이피

GATEWAY= 게이트웨이

NETMASK= 넷마스크

HWADDR=00:1F:29:32:24:BC



"/etc/sysconfig/network-scripts/ifcfg-eth0" 11L, 208C written

[root@server105 ~]# route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

------  *               255.255.255.240 U     0      0        0 eth1

192.168.0.0     *               255.255.255.0   U     0      0        0 eth0

link-local      *               255.255.0.0     U     1002   0        0 eth0

link-local      *               255.255.0.0     U     1003   0        0 eth1

default         -----  0.0.0.0         UG    0      0        0 eth1

[root@server105 ~]# /etc/init.d/network restart

Shutting down interface eth0:  [  OK  ]

Shutting down interface eth1:  [  OK  ]

Shutting down loopback interface:  [  OK  ]

Bringing up loopback interface:  [  OK  ]

Bringing up interface eth0:  Determining if ip address 192.168.0.105 is already in use for device eth0...

[  OK  ]

Bringing up interface eth1:  Determining if ip address 222.122.192.105 is already in use for device eth1...

[  OK  ]

[root@server105 ~]# route

Kernel IP routing table

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface

192.168.0.96    *               255.255.255.240 U     0      0        0 eth0

222.122.192.96  *               255.255.255.240 U     0      0        0 eth1

link-local      *               255.255.0.0     U     1002   0        0 eth0

link-local      *               255.255.0.0     U     1003   0        0 eth1

default         ------  0.0.0.0         UG    0      0        0 eth1

[root@server105 ~]# ping www.google.co.kr

ping: unknown host www.google.co.kr

[root@server105 ~]# 

[root@server105 ~]# vi /etc/resolv.conf 


nameserver  네임서버 맞게!

~


"/etc/resolv.conf" 1L, 24C written

[root@server105 ~]# 

[root@server105 ~]# 

[root@server105 ~]# /etc/init.d/network restart

Shutting down interface eth0:  [  OK  ]

Shutting down interface eth1:  [  OK  ]

Shutting down loopback interface:  [  OK  ]

Bringing up loopback interface:  [  OK  ]

Bringing up interface eth0:  Determining if ip address 192.168.0.105 is already in use for device eth0...

[  OK  ]

Bringing up interface eth1:  Determining if ip address 222.122.192.105 is already in use for device eth1...

[  OK  ]

[root@server105 ~]# ping www.google.co.kr

PING www.google.co.kr (172.217.25.227) 56(84) bytes of data.



^C

--- www.google.co.kr ping statistics ---

4 packets transmitted, 0 received, 100% packet loss, time 3177ms


[root@server105 ~]# 

[root@server105 ~]# 

[root@server105 ~]# 

[root@server105 ~]# 

[root@server105 ~]# 

반응형