ubuntu网络配置_ubuntu系统菜鸟入门

ubuntu网络配置_ubuntu系统菜鸟入门,第1张

ubuntu网络配置_ubuntu系统菜鸟入门 Ubuntu 16.04查看IP、网关、DNS等信息root@ubuntu:~# cat /proc/version #查看发行版本Linux version 4.9.40-eve-ng-ukms-2+ (root@ubuntu) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #4 SMP Fri Sep 15 02:07:02 CEST 2017root@ubuntu:~#查看IP地址:root@ubuntu:~# ifconfigroot@ubuntu:~# ip add show查看路由、网关(gateway)root@ubuntu:~# routeKernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Ifacedefault 192.168.246.2 0.0.0.0 UG 0 0 0 pnet0root@ubuntu:~# route -n #-n 表示不解析名字Kernel IP routing tableDestination Gateway Genmask Flags Metric Ref Use Iface0.0.0.0 192.168.246.2 0.0.0.0 UG 0 0 0 pnet010.163.1.0 0.0.0.0 255.255.255.0 U 0 0 0 pnet1Flags,如果是U代表活动的路由,出现G代表这个网络接口连接的是网关,H代表是一个主机root@ubuntu:~# netstat -rnKernel IP routing tableDestination Gateway Genmask Flags MSS Window irtt Iface0.0.0.0 192.168.246.2 0.0.0.0 UG 0 0 0 pnet010.163.1.0 0.0.0.0 255.255.255.0 U 0 0 0 pnet1查看DNSroot@ubuntu:~# cat /etc/resolv.conf# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)# DO NOT EDIT THIS FILE BY HAND — YOUR CHANGES WILL BE OVERWRITTENnameserver 192.168.246.2root@ubuntu:~#查看网络服务状态root@ubuntu:~# systemctl status networking重启网络服务root@ubuntu:~# systemctl restart networking或root@ubuntu:~# service networking restartping命令root@ubuntu:~# ping -c 3 192.168.246.2 #向网关ping 3个包PING 192.168.246.2 (192.168.246.2) 56(84) bytes of data.64 bytes from 192.168.246.2: icmp_seq=1 ttl=128 time=0.251 ms64 bytes from 192.168.246.2: icmp_seq=2 ttl=128 time=0.300 ms64 bytes from 192.168.246.2: icmp_seq=3 ttl=128 time=0.280 ms— 192.168.246.2 ping statistics —3 packets transmitted, 3 received, 0% packet loss, time 2039msrtt min/avg/max/mdev = 0.251/0.277/0.300/0.020 ms查看网络接口配置文件root@ubuntu:~# cat /etc/network/interfaces# This file describes the network interfaces available on your system# and how to activate them. For more information, see interfaces(5).# The loopback network interfaceauto loiface lo inet loopback# The primary network interfaceiface eth0 inet manualauto pnet0iface pnet0 inet staticaddress 192.168.246.177netmask 255.255.255.0gateway 192.168.246.2dns-nameservers 192.168.246.2bridge_ports eth0bridge_stp off关闭接口root@ubuntu:~# ifdown pnet3启用接口root@ubuntu:~# ifup pnet3root@ubuntu:~# ifdown eth0 #想关闭eth0来着,但是系统提示没有配置,估计是eth0没有配置IP地址的原因ifdown: interface eth0 not configuredroot@ubuntu:~#查看路由跟踪信息root@ubuntu:~# traceroute www.toutiao.comtraceroute to www.toutiao.com (36.156.179.242), 30 hops max, 60 byte packets1 192.168.246.2 (192.168.246.2) 0.125 ms 0.059 ms 0.084 ms2 * * *

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/651474.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-17
下一篇 2022-04-17

发表评论

登录后才能评论

评论列表(0条)

保存