Telnet to the server using SSH under Linux

Source: Internet
Author: User
Tags vps iptables vps server

If your own server is in the intranet, want to network through SSH on their own VPS server telnet to their own intranet server, you can follow the following actions:

First, use the following command on your own server:

#ssh-cfnnt-r Port a:localhost: Port B vpsip-p Port C-l root

Port A is an already available port on your VPS, that is, a port that is not occupied by other
Port B is the port of SSH on your server, the default is 22
Port C is the port of SSH on your VPS
Root is the root user of your VPS

Assuming port A is 5000, Port B is 22, Port c is the IP of the 3000,VPS server is 123.123.123.123

So the above command is
#ssh-cfnnt-r 5000:localhost:22 123.123.123.123-p 3000-l Root

The purpose of this command is to map the 22 port of the intranet server to the 5000 port on your VPS server.

The 3000 port of the above command is actually not related to the mapping port, but the execution of this command requires SSH connection to your VPS server, while the VPS server SSH external Port is 3000

After the server in the intranet enters the above command, you need to enter the password of the root user of your VPS server and then complete the port mapping.

Second, then login to your own VPS

On your own VPS server login intranet server, login command is ssh-p [email protected], follow the prompts to enter their own intranet server root user's password is OK

attached: CentOS View port usage and open port command
CentOS View port occupancy commands, such as view 80 port occupancy using the following command:
lsof-i tcp:80
List all ports
NETSTAT-NTLP
1. Open port (take port 80 as an example)
method One:
/sbin/iptables-i input-p TCP--dport 80-j ACCEPT write Modifications
/etc/init.d/iptables Save Changes
Service iptables Restart Restart Firewall, modification takes effect
Method Two:
Vi/etc/sysconfig/iptables Open the configuration file by adding the following statement:
-A input-p tcp-m State--state new-m TCP--dport 80-j ACCEPT reboot firewall, modify complete
2. Close the port
method One:
/sbin/iptables-i input-p TCP--dport 80-j DROP Write modification
/etc/init.d/iptables Save Changes
Service iptables Restart Restart Firewall, modification takes effect
Method Two:
Vi/etc/sysconfig/iptables Open the configuration file by adding the following statement:
-A input-p tcp-m State--state new-m TCP--dport 80-j DROP reboot firewall, modify complete
3. View Port Status
/etc/init.d/iptables Status

Telnet to the server using SSH under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.