Forward A Local Port to A Local/External Port
ssh
Refer to https://swsmile.info/post/linux-ssh-usage/
socat
Refer to https://swsmile.info/post/linux-socat/
iptables
Refer to https://swsmile.info/post/linux-iptables/
pfctl
Refer to https://swsmile.info/post/freebsd-pfctl/
Forward An External Port to An External Port
My scenarios is:
- The IP of 1.1.1.1 is xx.rwlb.singapore.rds.aliyuncs.com
- My local development env is not able to directly access 1.1.1.1 due to security concerns
- My DBA sets a jump server (2.2.2.2:3306) as a proxy to allow my local development env to indirectly access 1.1.1.1
- However, all middleware addresses are hard coded in my code repo, i.e., 1.1.1.1
- I wanna not modify the code and am still able to connect to all middleware
Idea: map 1.1.1.1:32111 to 2.2.2.2:3306 on kernel level, so that connecting 1.1.1.1:32111 actually is forwarded to 2.2.2.2:3306. As a result, my code doesn’t need any changes.
iptables
Refer to https://swsmile.info/post/linux-iptables/
pfctl
// TODO didn’t figure out how exactly
Reference
- https://en.wikipedia.org/wiki/Bridging_(networking)
- https://docs.freebsd.org/en_US.ISO8859-1/books/handbook/network-bridging.html
FEATURED TAGS
algorithm
algorithmproblem
architecturalpattern
architecture
aws
c#
cachesystem
codis
compile
concurrentcontrol
database
dataformat
datastructure
debug
design
designpattern
distributedsystem
django
docker
domain
engineering
freebsd
git
golang
grafana
hackintosh
hadoop
hardware
hexo
http
hugo
ios
iot
java
javaee
javascript
kafka
kubernetes
linux
linuxcommand
linuxio
lock
macos
markdown
microservices
mysql
nas
network
networkprogramming
nginx
node.js
npm
oop
openwrt
operatingsystem
padavan
performance
programming
prometheus
protobuf
python
redis
router
security
shell
software testing
spring
sql
systemdesign
truenas
ubuntu
vmware
vpn
windows
wmware
wordpress
xml
zookeeper