DAY5
DAY5

ubuntu 서버 구축

oracle
new -> ubuntu24101
            D:\vm
            D:\ubuntu.iso
            무인설치 건너뛰기 [체크]

ubuntu [시작]
            enter
            done
            ubuntu server 설치> done
            dhcp :: 10.0.2.15/24 확인(NAT)
            mirror location 설치
            file system 확인
            done
            continue
            (master/master/master/123456/123456)
            install open ssh server [체크]
            done
            done
            reboot now
            종료

파일 -> 가상시스템 내보내기 (재설치 필요 없어짐)
      -> 가상시스템 가져오기 (ubuntu 24102)

Bootstrap Example

라우터 설정

[R1]
config t
hostname HACKER
interface fastethernet0/0
ip address 100.100.100.254 255.255.255.0
no shutdown
exit
interface serial1/0
ip address 1.1.1.1 255.255.255.252
no shutdown
exit

router rip
version 2
network 100.100.100.0
network 1.1.1.0

[R2]
config t
hostname ST
interface fastethernet0/0
ip address 10.0.2.15 255.255.255.0
no shutdown
exit
interface serial1/0
ip address 1.1.1.2 255.255.255.252
no shutdown
router rip
version 2
network 10.0.2.0
network 1.1.1.0


Bootstrap Example

ubuntu ip 설정

sudo nano /etc/netplan/50[tab]

network:
version: 2
ethernets:
enp0s3
      dhcp4: no
      addresses: [10.0.2.15/24]
      gateway4: 10.0.2.2
      nameservers:
            addresses: [168.126.63.1]

ctrl+x, sft+y, enter
sudo netplan apply

NAT 설정
      (NAT로 네트워크를 설정하여 외부 네트워크와 연결되어야 ubuntu에 웹서버 설치가 가능하다.)
kali > ping 168.126.63.1 (연결확인)
sudo apt -y install lamp-server^ (웹서버 설치)

Bootstrap Example

r2 설정 변경!

config t
hostname ST
interface fastethernet0/0
ip address *125.246.95.254* 255.255.255.0
no shutdown
exit
interface serial1/0
ip address 1.1.1.2 255.255.255.252
no shutdown
router rip
version 2
network 10.0.2.0
network 1.1.1.0


Bootstrap Example

ping을 막는 방법

1. 라우터에서 막는 방법
(show access-lists > Standard IP access list 1
          10 deny 100.100.100.1
          20 permit any)
config t
access-list 1 deny 100.100.100.1 0.0.0.0
access-list 1 permit any
interface fastethernet0/0
ip access-group 1 out
exit

or

config t
access-list 1 deny 100.100.100.1 0.0.0.0
access-list 1 permit any
interface serial1/0
ip access-group 1 in
exit

2. 서버에서 막는 방법
sudo tcpdump
sudo tcpdump -i enp0s3 icmp
sudo sysctl -a | grep icmp
sudo sysctl -w net.ipv4.icmp_echo_ignore_all=1
      (=0에서 =1로 바꿔주면 ping에 반응 안하게 됨)
또는
iptables -A INPUT -p icmp -j DROP
iptables -L로 확인
sudo iptables -A INPUT -p icmp -j DROP
sudo iptables -F



Bootstrap Example

UTM

*서버 설정하기
외부 네트워크는 NAT으로 설정할 것 (NAT으로 설정해야 인터넷이 가능)

e0 : 호스트 전용 어댑터 (192.168.56.100)

oracle
머신 > asg-9.720(오류 문제로 9.5로 다운그레이드)
      랜카드 4개 확인(사진;인터페이스 추가)
            eth0 : 호스트 전용 어댑터 설정(케이블 연결 [체크])
                  (window ip 이더넷에 192.168.56.107 대역이 존재하므로 사용 가능)
            eth1 : outside (125.246.95.254)
            eth2 : DMZ (10.0.2.2)
            eth3 : inside (192.168.0.254)
                  웹에서 dhcp 설정(사진;dhcp 설정) -> pc1 > dhcp (192.168.0.1 확인)
                  단, 서버(DMZ)는 안정적으로 고정IP 사용해야 한다!!

web(사진; utm 웹) > http://192.168.56.100:4444
      (admin/123456/st@st.kr)

Bootstrap Example

방화벽


eth0(pc1)>ping 10.0.2.2 (eth2,연결확인)
      ping 192.168.0.254 (3th3, 연결확인)

eth0(server,ubuntu)>ping 10.0.2.2 (eth2, 연결확인)
        ping 192.168.0.254 (eth3, 연결확인)

eth0(pc1)>ping 10.0.2.15 (eth0(server)연결안됨)
      (방화벽의 기본 특성상 UTM 너머의 서버에 연결되지 않는다.)
            연결되려면? 서버 정의하기(웹>네트워크 정의)(사진;서버)