How do you add a new linux interface?



  • Hello! There's a linux server, a ssh tunnel connected to it. How do you add this ssh-tunnel to network/interfaces so the server could see it as an additional ip?

    That's how you can get through the ipip tunnel or a pptp, but ssh is what I need. Since there are 10 servers I'm gonna connect through the ssh tunnel and I need to add 10 interfaces with different external epics. Can you tell me how to do this?

    P.S. On the servers I'm going to ssh to do nothing.



  • Before you launch a demon ssh in Point mode - to - Point, you need to prepare tun for each server. This can be done in two ways:

    1. Team tuntap:
    
        ip tuntap add dev tun0 mode tun
    
    1. Keep the devices ready, add /etc/systemd/network/ netdev device:
    
    [NetDev]
    Name=tun0
    Kind=tun
    

    #Разрешить доступ пользователям входящим в группу vpn
    [Tun]
    Group=vpn

    And network file:


    [Match]
    Name=tun0

    [Address]
    Address=172.17.0.1/30
    Peer=172.17.0.2/30

    [Network]
    Address=172.17.0.1/30

    [Route]
    Gateway=172.17.0.1
    Destination=192.168.1.0/24

    The second option is preferable because:

    • The firewall will be aware of the existence of such devices
    • The tunnel can be opened by an untouched user
    • You can build the routes in advance, not sign them every time you want to connect.

    http://influunt.ru/p2p-tunnel-with-ssh




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2