Ubuntu系统进行网络配置有的时候用图形界面不起做用,这种状况下能够直接修改某些启动脚本或配置文件html
Ubuntu系统进行网络配置涉及到几个配置文件1./etc/network/interfaces 2./etc/resolv.conflinux
操纵步骤:ubuntu
1.打开ubuntu的/etc/network/interfaces文件默认的内容以下:服务器
auto lo网络
iface lo inet loopbackless
动态获取的配置方法:ssh
auto eth0oop
iface eth0 inet dhcpspa
静态分配的配置方法:3d
auto eth0
iface eth0 inet static
address 192.168.0.1
netmask 255.255.255.0
gateway 192.168.0.1
dns-nameservers 8.8.8.8
根据配置要求(是动态分配仍是自动获取)修改该配置文件保存。
2.添加域名服务器:打开/etc/resolv.conf文件
添加这行:nameserver 202.99.166.4
3.重启下网络
$/etc/init.d/networking restart(这条命令是重启网卡)
ubuntu 14.04 修改主机名
第一步:ubuntu主机名位于/etc/hostname里,将其修改成本身须要的名称。
第二步:修改/etc/hosts文件,将其中127.0.1.1对应的主机名更改成新的主机名,与/etc/hostname里的主机名一致。
打开"终端窗口",输入"sudo apt-get update"-->回车-->"输入当前登陆用户的管理员密码"-->回车,就能够了。
打开"终端窗口",输入"sudo apt-get install openssh-server"-->回车-->输入"y"-->回车-->安装完成。
打开"终端窗口",输入"sudo ps -e |grep ssh"-->回车-->有sshd,说明ssh服务已经启动,若是没有启动,输入"sudo service ssh start"-->回车-->ssh服务就会启动。
使用gedit修改配置文件"/etc/ssh/sshd_config"
打开"终端窗口",输入"sudo gedit /etc/ssh/sshd_config"-->回车-->把配置文件中的"PermitRootLogin without-password"加一个"#"号,把它注释掉-->再增长一句"PermitRootLogin yes"-->保存,修改为功。
打开"终端窗口",输入"sudo ifconfig"-->回车-->就能够查看到IP地址。
ubuntu 15.10 安装 openssh-server后,使用ssh客户端链接时可能报此错误,状况如上图所示
server responded "algorithm negotiation failed”
解决方法
修改ssh的配置文件 /etc/ssh/sshd_config
在配置文件中添加:
Ciphers aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,3des-cbc,arcfour128,arcfour256,arcfour,blowfish-cbc,cast128-cbc
MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-sha1-96,hmac-md5-96
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org
ubuntu linux 进入root用户,管理员模式
编辑这个文件须要管理员模式
在GRUB_CMD_LINUX后面增长图中所示
看到这个地方了没,有提示信息的,想要改变这个文件,记得运行 update-grub使之生效
执行后状态这样子的
还有一个地方,咱们须要添加如下
编辑这个文件
增长两行
auto eth0
iface eth0 inet dhcp
重启下ubuntu,从新打开终端,执行命令ifconfig