zoukankan      html  css  js  c++  java
  • linux系统中实现网络会话共享功能

    实验一共需要三台主机完成:

    PC1:192.168.10.10

    PC2:192.168.10.20

    PC2:192.168.10.30

    1、测试三台主机网络连通性

    [root@PC1 ~]# ifconfig | head -n 3
    eno16777728: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.10.10  netmask 255.255.255.0  broadcast 192.168.10.255
            inet6 fe80::20c:29ff:fe66:37f7  prefixlen 64  scopeid 0x20<link>
    [root@PC1 ~]# ping -c 3 192.168.10.20
    PING 192.168.10.20 (192.168.10.20) 56(84) bytes of data.
    64 bytes from 192.168.10.20: icmp_seq=1 ttl=64 time=0.294 ms
    64 bytes from 192.168.10.20: icmp_seq=2 ttl=64 time=0.195 ms
    64 bytes from 192.168.10.20: icmp_seq=3 ttl=64 time=0.197 ms
    
    --- 192.168.10.20 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 2000ms
    rtt min/avg/max/mdev = 0.195/0.228/0.294/0.049 ms
    [root@PC1 ~]# ping -c 3 192.168.10.30
    PING 192.168.10.30 (192.168.10.30) 56(84) bytes of data.
    64 bytes from 192.168.10.30: icmp_seq=1 ttl=64 time=0.220 ms
    64 bytes from 192.168.10.30: icmp_seq=2 ttl=64 time=0.210 ms
    64 bytes from 192.168.10.30: icmp_seq=3 ttl=64 time=0.203 ms
    
    --- 192.168.10.30 ping statistics ---
    3 packets transmitted, 3 received, 0% packet loss, time 1999ms
    rtt min/avg/max/mdev = 0.203/0.211/0.220/0.007 ms

    2、PC2主机ssh远程连接PC1主机,然后使用screen命令创建两个网络会话test01和test02

    [root@PC2 ~]# ssh root@192.168.10.10
    root@192.168.10.10's password: 
    Last login: Sat Dec 19 23:40:45 2020 from 192.168.10.30
    [root@PC1 ~]# screen -ls
    No Sockets found in /var/run/screen/S-root.
    
    [root@PC1 ~]# screen -S test01   ## ctrl + a + d 退出
    [detached from 33223.test01]
    [root@PC1 ~]# screen -S test02   ## ctrl+ a + d 退出
    [detached from 33249.test02]
    [root@PC1 ~]# screen -ls
    There are screens on:
        33249.test02    (Detached)
        33223.test01    (Detached)
    2 Sockets in /var/run/screen/S-root.
    [root@PC1 ~]# screen -r test01 ## 进入会话 test01

    3、PC3主机ssh远程登录PC1主机,执行screen -x test01,就可以实现会话共享

     

    以上实验实现PC2主机和PC2主机远程登录PC1主机之后的会话共享。

  • 相关阅读:
    .net中实现运行时从字符串动态创建对象
    C# 用 VB.net 函數庫 實現全角與半角轉換
    實現.net 加載插件方式
    VS2008下載
    Lotus Notes Send EMail from VB or VBA
    用C#写vs插件中的一些Tip
    SQL2005中异常处理消息框可直接使用
    C#路径/文件/目录/I/O常见操作汇总
    利用.net反射动态调用指定程序集的中的方法
    说说今年的计划
  • 原文地址:https://www.cnblogs.com/liujiaxin2018/p/14162220.html
Copyright © 2011-2022 走看看