网卡配置
liujunjun@liujunjun-virtual-machine:~$ sudo cat /etc/network/interfaces [sudo] liujunjun 的密码: # interfaces(5) file used by ifup(8) and ifdown(8) auto lo iface lo inet loopback auto ens33 iface ens33 inet static address 192.168.1.235 netmask 255.255.255.0 gateway 192.168.1.1 liujunjun@liujunjun-virtual-machine:~$
配置DNS
liujunjun@liujunjun-virtual-machine:~$ cat /etc/systemd/resolved.conf # This file is part of systemd. # # systemd is free software; you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published by # the Free Software Foundation; either version 2.1 of the License, or # (at your option) any later version. # # Entries in this file show the compile time defaults. # You can change settings by editing this file. # Defaults can be restored by simply deleting this file. # # See resolved.conf(5) for details [Resolve] DNS=114.114.114.114 DNS=8.8.8.8 #DNS= #FallbackDNS= #Domains= #LLMNR=no #MulticastDNS=no #DNSSEC=no #Cache=yes #DNSStubListener=yes
网卡起动
liujunjun@liujunjun-virtual-machine:~$ /etc/init.d/network networking network-manager liujunjun@liujunjun-virtual-machine:~$ /etc/init.d/networking force-reload Reloading networking configuration (via systemctl): networking.service==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === 重新启动“networking.service”需要认证。 Authenticating as: liujunjun,,, (liujunjun) Password: ==== AUTHENTICATION COMPLETE === . liujunjun@liujunjun-virtual-machine:~$ /etc/init.d/networking restart Restarting networking (via systemctl): networking.service==== AUTHENTICATING FOR org.freedesktop.systemd1.manage-units === 重新启动“networking.service”需要认证。 Authenticating as: liujunjun,,, (liujunjun) Password: ==== AUTHENTICATION COMPLETE === . liujunjun@liujunjun-virtual-machine:~$
如果IP地址没生效
解决方法: ip addr flush dev ens33 ifdown ens33 ifup ens33
安装SSHD服务
sudo apt-get install openssh-server sudo apt-get install openssh-client
修改/etc/ssh/sshd_config
liujunjun@liujunjun-virtual-machine:~$ sudo cat /etc/ssh/sshd_config |grep PasswordAuthentication PasswordAuthentication yes # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication, then enable this but set PasswordAuthentication
liujunjun@liujunjun-virtual-machine:~$ sudo /etc/init.d/ssh restart
Restarting ssh (via systemctl): ssh.service.
SecureCRT 连接Win10内置ubuntu问题及解决办法
在SecureCRT sessions > properties > Connection > SSH2 取消勾选 PublicKey.
关闭防火墙并开机不启动
liujunjun@liujunjun-virtual-machine:~$ sudo ufw disable 防火墙在系统启动时自动禁用
来源:https://www.cnblogs.com/liujunjun/p/12244174.html