Linux服务器基础网络配置

广告也精彩

1.查看当前网络设置ifconfigifconfig eth0; #查看eth0接口网络设置 ifconfig -a #查看所有网络接口的信息route 显示路由表route | grep default 显示主机的默认网关。ping -c 4 192.168.1.10 发送指定数量的数据包进行网络连接测试。traceroute 192.168.1.10 测试与其他主机的网络连接路径。hostname 显示当前主机名称。ifdown eth0 && ifup eth0 用来重启eth0网卡2.修改配置文件进行网络配置CentOS网卡eth0的配置文件:/etc/sysconfig/network-scripts/ifcfg-eth0Ubuntu网卡eth0的配置文件:/etc/network/interfaces2.1网络接口配置文件 :CentOS设置静态IP 地址内容如下 :DEVICE=eth0 #设置网络接口名称 ONBOOT=yes #设置网络接口在系统启动时激活。 BOOTPROTO=static #配置为静态地址

Linux服务器基础网络配置

IPADDR=192.168.1.10 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 #网络接口的默认网关
DNS1=8.8.8.8 DNS2=4.4.4.4CentOS使用DHCP 方式获得网络配置内容:DEVICE=eth0 ONBOOT=yes BOOTPROTO=dhcpUbuntu设置静态IP 地址内容如下 :auto eth0 iface eth0 inet static address 192.168.1.75 gateway 192.168.1.1
netmask 255.255.255.0 dns-nameservers 8.8.8.8 dns-nameservers 4.4.4.4Ubuntu使用DHCP 方式获得网络配置内容 :auto eth0 iface eth0 inet dhcp2.2查看生效的DNS(通用)cat /etc/resolv.conf3.ubuntu的iptables设置.

 

转载于天翼云知识,如有侵权,请联系删除,谢谢

© 版权声明
广告也精彩

相关文章

广告也精彩

暂无评论

暂无评论...