解决如下问题:
$ sudo apt install openssh-server
sudo apt install openssh-server
$ sudo ifconfig eth0 192.168.1.128
bug
Command 'ifconfig' not found, but can be installed with:sudo apt install net-tools
安装网络配置工具
$ sudo apt install net-tools
SIOCSIFADDR: No such device
eth0: ERROR while getting interface flags: No such device
$ ifconfig -a
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.128 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::9dcf:c37c:7fac:ba36 prefixlen 64 scopeid 0x20<link>
ether 00:0c:29:38:3c:9b txqueuelen 1000 (Ethernet)
RX packets 18027 bytes 14133887 (14.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12010 bytes 2438066 (2.4 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 2779 bytes 308155 (308.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 2779 bytes 308155 (308.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
sudo ifconfig ens33 192.168.1.128
> ping 192.168.1.128
$ ping 192.168.43.86 //windows'IP
PING 192.168.43.86 (192.168.43.86) 56(84) bytes of data.
64 bytes from 192.168.43.86: icmp_seq=1 ttl=128 time=0.690 ms
64 bytes from 192.168.43.86: icmp_seq=2 ttl=128 time=1.58 ms
64 bytes from 192.168.43.86: icmp_seq=3 ttl=128 time=0.701 ms
64 bytes from 192.168.43.86: icmp_seq=4 ttl=128 time=1.15 ms
64 bytes from 192.168.43.86: icmp_seq=5 ttl=128 time=1.26 ms
64 bytes from 192.168.43.86: icmp_seq=6 ttl=128 time=1.28 ms
64 bytes from 192.168.43.86: icmp_seq=7 ttl=128 time=0.729 ms
64 bytes from 192.168.43.86: icmp_seq=8 ttl=128 time=1.42 ms
下载Bitvise:(https://gsf-fl.softonic.com/7ad/b68/5b5d78c4e89613515d05ced58f7e6441dc/BvSshClient-Inst.exe?Expires=1648438562&Signature=8717178bf9438eb3d501410323d35c203b359299&url=https://tunnelier.en.softonic.com&Filename=BvSshClient-Inst.exe)
设置Linux主机ip地址,输入用户名,输入密码,输入点击Log in
ssh-keygen
$ ssh-keygen -b 2048 -t rsa
$ chmod -R 700 .ssh
$ whomi
成功登陆,可以实现文件传输与共享
安装NFS服务器端
$ sudo apt-get install nfs-kernel-server
$ sudo cat /proc/fs/nfsd/versions
-2 +3 +4 +4.1 +4.2
创建文件系统
$ sudo mkdir -p /srv/nfs4/www
$ sudo mount --bind /var/www /srv/nfs4/www
$ sudo vim /etc/fstab
/etc/fstab
/var/www /srv/nfs4/www none bind 0 0
导出文件系统
$ sudo vim /etc/exports
/srv/nfs4 192.168.1.*(rw,sync,no_subtree_check,crossmnt,fsid=0)
/srv/nfs4/www 192.168.1.*(rw,sync,no_subtree_check)
$ sudo exportfs -ar
$ sudo exportfs -v
/srv/nfs4 192.168.1.129(rw,wdelay,crossmnt,root_squash,no_subtree_check,fsid=0,sec=sys,rw,secure,root_squash,no_all_squash)
/srv/nfs4/www 192.168.1.129(rw,wdelay,root_squash,no_subtree_check,sec=sys,rw,secure,root_squash,no_all_squash)
安装NFS客户端
$ sudo apt update
$ sudo apt install nfs-common
$ sudo mkdir -p /srv/www
$ sudo mount -t nfs -o vers=4 192.168.1.128:/www /srv/www
mount.nfs: requested NFS version or transport protocol is not supported
$ sudo /etc/init.d/nfs-kernel-server start
$ df -h
$ sudo vim /etc/fstab
/etc/fstab
192.168.1.128:/www /srv/www nfs defaults,timeo=900,retrans=5,_netdev 0 0
TFTP服务器
$ sudo apt install -y tftpd-hpa
TFTP服务器端
$ sudo vim /etc/default/tftpd-hpa
/etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftp"
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s" //tip:--list,--create,--secure
$ sudo mkdir /tftp
$ sudo chmod -R 777 /tftp
$ sudo chmod -R nobody /tftp
$ echo 'hello,world!' > /tftp/test.txt //服务器创建测试文件
$ sudo service tftpd-hpa start
$ sudo service tftpd-hpa status //查看状态
Job for tftpd-hpa.service failed because the control process exited with error code.
- $ sudo vim /etc/default/tftpd-hpa
/etc/default/tftpd-hpa
TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/tftp" //地址确认!!!
TFTP_ADDRESS="0.0.0.0:69"
TFTP_OPTIONS="-l -c -s" //tip:--list,--create,--secure
TPTP客户端
$ sudo apt install -y tftp-hpa
测试连接
$ tftp 192.168.1.128
tfpt> get test.txt
tftp> q
$ cat test.txt