Redirecting tcp / udp ports with socat
Socat is a command line based utility that establishes two bidirectional byte streams and transfers data between them. It has lots of feauters you can see on it's man page.
Here we discuss a general problem: You just changed your ISP and your website has new ip address. But, some requests still comes to old ip due to the DNS cache issues. So, you want to forward all traffic which comes to old ip to new ip transparently for a few days like port forwarding in a gateway:
socat TCP-LISTEN:80,fork TCP:NEW_IP:80
In this example, socat waits for a connection to port 80 on old ip server and accepts new connections, forks and transparently relays to new host's port 80.
Socat can forward UDP sockets too. Indeed, it is even possible to listen UNIX domain socket with socat and forward it to a remote TCP socket. Thanks for this great utility.
- 0 Comment
- Murat Demirten
- 04 May 2008, 11:50
-
You must be login first or sign-up for an account to post comments.
Maybe you should look at these also:
USERBOX
CATEGORIES
MOST READ TODAY
- Disabling reverse dns lookups in ssh
- Redirecting tcp / udp ports with socat
- Users with /bin/false shell to login on vsftpd
- Enabling remote desktop on a VirtualBox Machine
- Disabling ssh password authentication
- How to extract a deb package without installing
- Passwordless sudo setup
- Syntax highlighting in less
- Remove all frozen messages from exim mail queue
- XFS Filesystem has duplicate UUID problem
LAST ADDED
- Using iPhone internet sharing over bluetooth under Linux
- Using USB sound card with amarok
- Multi-conditional search and replace (clearing a ftp trojan script example)
- Disabling ipv6 functionality
- How to convert a mp3 file
- How to choose the fastest Debian mirror
- Disabling reverse dns lookups in ssh
- Rewriting destination ip address
- Deleting A File By It's Inode Value
- Learning which libraries are used for a binary
