-
리눅스 ssh ,http 외부네트워크 접속환경구축LINUX 2017. 3. 22. 14:46반응형
이글은 CentOS Linux release 7.3.1611 (Core) 서버에서 작업되었습니다.
1. 네트워크 설정이 완료되어있다.
-> 네트워크 설정
vi /etc/sysconfig/network-scripts/ifcfg-eno1
vi /etc/sysconfig/network-scripts/ifcfg-eth0
둘중 하나가 있을것이다. 이 파일을
[root@cobuy-0938 ~]# vi /etc/sysconfig/network-scripts/ifcfg-eno1
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
IPV6_ADDR_GEN_MODE=stable-privacy
NAME=eno1
UUID=6d3280bb-53d3-485f-8fd0-0fc4e5920e88
DEVICE=eno1
ONBOOT=yes
IPADDR=서버 아이피
NETMASK=넷마스크주소
GATEWAY=게이트워이주소
ZONE=public
이런식으로 작성해준뒤
/etc/init.d/network restart
네트워크 재시작을 해서 적용해준다.
그후
[root@cobuy-0938 ~]# route
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default gateway 0.0.0.0 UG 100 0 0 eno1
192.168.0.0 0.0.0.0 255.255.255.0 U 100 0 0 eno2
xxx.xxx.xxx.xxx 0.0.0.0 255.255.255.240 U 100 0 0 eno1
route 명령어로 나가고 들어오고가 잘 되고있는지 확인한다.
ping www.google.co.kr //을 통해서 아이피가 제대로 나오는지 확인도 해보자~
2. 아파치 설치가 완료되어있다.
http://www.atblog.co.kr/?p=6255
위 주소에서 보고 따라하자!
안되는건 저도 똑같이 안되었을 가능성이 높으니 , 블로그에서 검색해보세여~
3. url 에 서버 아이피를 넣지만 안된다.
이런식으로
1. 아파치 재시작
/usr/local/apache/bin/httpd -k restart
2. 아파치가 항상동작하게 설정 (리붓후 자동 재실행)
systemctl enable httpd
3. http 방화벽 영구적허용
firewall-cmd --permanent --add-service=http
4. ssg 방화벽 영구적 허용
firewall-cmd --permanent --add-service=ssh
5. 방화벽 reload
firewall-cmd --reload
이러고 다시 아이피를 치고 접속하면 접속이 된다.
아래는 로그입니다.
--------------------------------------------------------------------------------
[root@cobuy-0938 ~]# /usr/local/apache/bin/httpd -k restart
[root@cobuy-0938 ~]# sys
sysctl systemd-coredumpctl systemd-loginctl systemd-sysv-convert
systemctl systemd-delta systemd-machine-id-setup systemd-tmpfiles
systemd-analyze systemd-detect-virt systemd-notify systemd-tty-ask-password-agent
systemd-ask-password systemd-escape systemd-nspawn sys-unconfig
systemd-cat systemd-firstboot systemd-path
systemd-cgls systemd-hwdb systemd-run
systemd-cgtop systemd-inhibit systemd-stdio-bridge
[root@cobuy-0938 ~]# system
systemctl systemd-coredumpctl systemd-inhibit systemd-run
systemd-analyze systemd-delta systemd-loginctl systemd-stdio-bridge
systemd-ask-password systemd-detect-virt systemd-machine-id-setup systemd-sysv-convert
systemd-cat systemd-escape systemd-notify systemd-tmpfiles
systemd-cgls systemd-firstboot systemd-nspawn systemd-tty-ask-password-agent
systemd-cgtop systemd-hwdb systemd-path
[root@cobuy-0938 ~]# system
systemctl systemd-coredumpctl systemd-inhibit systemd-run
systemd-analyze systemd-delta systemd-loginctl systemd-stdio-bridge
systemd-ask-password systemd-detect-virt systemd-machine-id-setup systemd-sysv-convert
systemd-cat systemd-escape systemd-notify systemd-tmpfiles
systemd-cgls systemd-firstboot systemd-nspawn systemd-tty-ask-password-agent
systemd-cgtop systemd-hwdb systemd-path
[root@cobuy-0938 ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@cobuy-0938 ~]#
[root@cobuy-0938 ~]#
[root@cobuy-0938 ~]#
[root@cobuy-0938 ~]#
[root@cobuy-0938 ~]#
[root@cobuy-0938 ~]# firewall-cmd --permanent --add-service=http
success
[root@cobuy-0938 ~]# firewall-cmd --permanent --add-service=ssh
Warning: ALREADY_ENABLED: ssh
success
[root@cobuy-0938 ~]# firewall-cmd --reload
success
[root@cobuy-0938 ~]# ifconfig -a
eno1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet xxx netmask 255.255.255.240 broadcast 222.122.192.111
inet6 fe80::7d95:6b6c:c692:f445 prefixlen 64 scopeid 0x20<link>
ether 0c:c4:7a:98:76:34 txqueuelen 1000 (Ethernet)
RX packets 3417395 bytes 566242177 (540.0 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2939771 bytes 575102261 (548.4 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfb200000-fb27ffff
eno2: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet xxxx netmask 255.255.255.0 broadcast 192.168.0.255
inet6 fe80::cfc5:5a1c:6d3f:a59c prefixlen 64 scopeid 0x20<link>
ether 0c:c4:7a:98:76:35 txqueuelen 1000 (Ethernet)
RX packets 553 bytes 52056 (50.8 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 32 bytes 2496 (2.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
device memory 0xfb100000-fb17ffff
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1 (Local Loopback)
RX packets 13 bytes 757 (757.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 13 bytes 757 (757.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
--------------------------------------------------------------------------------
반응형'LINUX' 카테고리의 다른 글
CentOS 아파치 설치하기 (0) 2017.03.22 CentOS7 mysql 설치하기 (0) 2017.03.22 configure: error: no acceptable C compiler found in $PATH (0) 2017.03.21 CentOS - php - mail 함수 사용하기 (0) 2017.03.13 메모리 스팩 알아보기 (0) 2017.03.13