Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- 신바람여비서win98
- windows19Server
- sftp
- 한글2 #hangul2_from_2024_01_17
- 아이티제어
- centos7
- MSSQL #TCP/IP Enabled
- 코드라마 #AI
- 윈도우앱지우기
- 에디트플러스 #sftp안될때
- winscp
- root직접로그인
- putty
- CenOS6.10
- php7
- ubunto #네티워크설정
- PHP4
- utf8mb4
- 인터넷안되는문제해결
- PID4
- CapsLock키보드 뽑기
- IT제어
- ftp
- 조성남
Archives
- Today
- Total
아이티제어
두대의 리눅스에서 tcp패킷을 그대로 다른 컴퓨터에 다른 포트로 전달해주는 기능 구현방법 본문
Linux/우분투Ubuntu
두대의 리눅스에서 tcp패킷을 그대로 다른 컴퓨터에 다른 포트로 전달해주는 기능 구현방법
프로그래머 파이브010-2629-0471 2023. 2. 14. 07:13
#iptables 설치:
sudo apt-get install iptables
# 현재 iptables 룰을 백업:
sudo iptables-save > /etc/iptables.rules
#iptables 룰을 초기화:
sudo iptables -F
sudo iptables -X
sudo iptables -t nat -F
sudo iptables -t nat -X
sudo iptables -t mangle -F
sudo iptables -t mangle -X
#리다이렉트 규칙 추가:
sudo iptables -t nat -A PREROUTING -p tcp --dport 3307 -j DNAT --to 10.11.227.4:3306
#리다이렉트 규칙 저장:
sudo iptables-save > /etc/iptables.rules
#부팅시 iptables 규칙 적용:
sudo nano /etc/rc.local
#다음과 같이 작성:
#!/bin/sh -e
iptables-restore < /etc/iptables.rules
exit 0
파일 권한 변경:
sudo chmod +x /etc/rc.local
# 이제, 10.1.1.2 서버에서 3307 포트로 진입하는 모든 TCP 패킷은 10.1.1.4 서버의 3306 포트로 리다이렉트됩니다.
설정한것을 보려면
iptables -t nat -L
'Linux > 우분투Ubuntu' 카테고리의 다른 글
파이이선 python3 -f /filepaht/filename -d DbName 같이 업션읽기 (0) | 2023.02.19 |
---|---|
우분투 iptable 등이 system 시작시 자동 실행 되게 하기 (0) | 2023.02.14 |
우분투 22 화면 둘러보기 (0) | 2022.08.15 |
우분투 초기 root 비밀번호 설정 (0) | 2022.08.15 |
Authentication required 우분투 잠김 화면 해결 법 (0) | 2022.08.15 |