OS Linux[centos,RHEL]/install 및 계정 보안 설정

Redhat/CentOS 6 설치 및 네트워크 설정

infra 2021. 11. 3. 14:22

https://linux.systemv.pe.kr/kvm%EC%97%90-bridge-network-%EC%84%A4%EC%A0%95/

 

 

KVM에 Bridge Network 설정 - Voyager of Linux

CentOS 6 에는 가상화로 KVM만 지원합니다. Xen은 빼버렸습니다. 가상화로 KVM을 하게되면 사용할 수 있게됩니다. 그런데, KVM을 활성화하게 되면 virbr0 라는 가상의 이더넷이 생성이되는데 이것이 NAT

linux.systemv.pe.kr

이를 활용하여 작성하였다.

 

KVM이 활성화되어있을 때는 virbr0 = 가상 브릿지 인터페이스가 있는데, 이게 NAT로 동작한다. 내, 외부 IP를 통신하므로,

KVM의 guest OS는 virbr0 의 NAT를 이용해서 인터넷이 되는 원리임.

 

내가 사용하는 환경은 위의 링크와 동일하게 공인 IP를 사용하지 않는 private IP를 할당받기를 원했기 때문에,

virbr0 을 정지시키고, ifcfg-br0(브릿지 인터페이스)를 만든 후 eth0 과 br0을 브릿지 시킴.

 

구성 전의 네트워크 정보

[root@rhel6 ~]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether MAC ADDRESS  brd ff:ff:ff:ff:ff:ff
    inet6 IPVER6/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether MAC ADDRESS   brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 500
    link/ether MAC ADDRESS brd ff:ff:ff:ff:ff:ff
    
    [root@rhel6 ~]# cd /etc/sysconfig/network-scripts/
[root@rhel6 network-scripts]# ll |grep br


[root@rhel6 network-scripts]# nmcli con list
NAME                      UUID                                   TYPE              SCOPE    TIMESTAMP-REAL                    
System eth0                                                802-3-ethernet    system   never                             
NAME                      UUID                                   TYPE              SCOPE    TIMESTAMP-REAL                    
[root@rhel6 network-scripts]# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------
default              active     yes           yes


2. 구성 설정 단계

[root@rhel6 network-scripts]# vim ifcfg-eth0

DEVICE=eth0 
#HWADDR= 주석처리
TYPE=Ethernet
#UUID=주석처리
ONBOOT=yes 
BRIDGE=br0 
NM_CONTROLLED=no
BOOTPROTO=none


[root@rhel6 network-scripts]#
[root@rhel6 network-scripts]# cp ifcfg-eth0 ifcfg-br0
[root@rhel6 network-scripts]# vim ifcfg-br0

 

DEVICE=br0
#HWADDR= 주석처리
TYPE=Bridge
#UUID=주석처리
ONBOOT=yes 
NM_CONTROLLED=no
BOOTPROTO=dhcp       //DHCP로 할당

 


[root@rhel6 network-scripts]# chkconfig NetworkManager off
[root@rhel6 network-scripts]# chkconfig network on
[root@rhel6 network-scripts]# service NetworkManager stop
Stopping NetworkManager daemon:                            [  OK  ]
[root@rhel6 network-scripts]# service network restart
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]
Bringing up interface br0:  
Determining IP information for br0... done.
                                                           [  OK  ]

 

3. 구성 및 설정 후의 네트워크 인터페이스 정보

 

 

[root@rhel6 network-scripts]# ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether MAC ADDRESS  brd ff:ff:ff:ff:ff:ff
    inet6 IPVER6/64 scope link 
       valid_lft forever preferred_lft forever
3: virbr0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether MAC ADDRESS  brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN qlen 500
    link/ethe MAC ADDRESS  brd ff:ff:ff:ff:ff:ff
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether MAC ADDRESS  brd ff:ff:ff:ff:ff:ff
    inet 192.168.202.129/24 brd 192.168.202.255 scope global br0
    inet6 IPVER6/64 scope link 
       valid_lft forever preferred_lft forever

 

 

 


[root@rhel6 network-scripts]# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=128 time=39.3 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=128 time=38.9 ms
^C
--- 8.8.8.8 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1204ms
rtt min/avg/max/mdev = 38.987/39.154/39.321/0.167 ms
[root@rhel6 network-scripts]# ping 168.126.63.1
PING 168.126.63.1 (168.126.63.1) 56(84) bytes of data.
64 bytes from 168.126.63.1: icmp_seq=1 ttl=128 time=4.06 ms
^C
--- 168.126.63.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 707ms
rtt min/avg/max/mdev = 4.068/4.068/4.068/0.000 ms
[root@rhel6 network-scripts]# ping 192.168.202.11
PING 192.168.202.11 (192.168.202.11) 56(84) bytes of data.
64 bytes from 192.168.202.11: icmp_seq=1 ttl=64 time=1.24 ms
^C
--- 192.168.202.11 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 717ms
rtt min/avg/max/mdev = 1.241/1.241/1.241/0.000 ms
[root@rhel6 network-scripts]# ping 192.168.202.12
PING 192.168.202.12 (192.168.202.12) 56(84) bytes of data.
64 bytes from 192.168.202.12: icmp_seq=1 ttl=64 time=2.19 ms
^C
--- 192.168.202.12 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 583ms
rtt min/avg/max/mdev = 2.195/2.195/2.195/0.000 ms
[root@rhel6 network-scripts]# ping 192.168.202.13
PING 192.168.202.13 (192.168.202.13) 56(84) bytes of data.
64 bytes from 192.168.202.13: icmp_seq=1 ttl=64 time=1.46 ms
^C
--- 192.168.202.13 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 930ms
rtt min/avg/max/mdev = 1.464/1.464/1.464/0.000 ms

 

GOOGLE 과 KT DNS PING 테스트

외부에도 붙고, 내부망의 서버들 또한 통신 됨.


[root@rhel6 network-scripts]# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------
default              active     yes           yes

 

http://ckb7814.tistory.com/68 

 

[ Step ] 04. 가상 네트워크 삭제 방법

가상 네트워크 삭제 방법을 알아보자.  1. 네트워크 확인 [root@localhost ~]# ifconfig -a ens192: flags=4163   mtu 1500         inet 192.168.1.xxx netmask 255.255.255.0  broadcast 19..

ckb7814.tistory.com

 

#man virsh

 

>virtual Network commands

 

[root@rhel6 network-scripts]# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------
default              active     yes           yes

[root@rhel6 network-scripts]# virsh net-destroy default
Network default destroyed

[root@rhel6 network-scripts]# virsh net-undefine default
Network default has been undefined

[root@rhel6 network-scripts]# virsh net-list
Name                 State      Autostart     Persistent
--------------------------------------------------

[root@rhel6 network-scripts]# service libvirtd restart
Stopping libvirtd daemon:                                  [  OK  ]
Starting libvirtd daemon:                                  [  OK  ]


[root@rhel6 network-scripts]# ip a      
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN 
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether  MAC ADDRESS  brd ff:ff:ff:ff:ff:ff
    inet6 IPVER6/64 scope link 
       valid_lft forever preferred_lft forever
6: br0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UNKNOWN 
    link/ether  MAC ADDRESS  brd ff:ff:ff:ff:ff:ff
    inet 192.168.202.129/24 brd 192.168.202.255 scope global br0
    inet6 IPVER6/64 scope link 
       valid_lft forever preferred_lft forever

 

'OS Linux[centos,RHEL] > install 및 계정 보안 설정' 카테고리의 다른 글

banner 만들기(보안)  (0) 2021.11.07