ubuntu网络配置相关知识(转载)
From:http://os.51cto.com/art/201003/188055.htm
文章主要介绍Ubuntu网络配置,希望能让Linux新手学习参考。更好使用Ubuntu。更有效的学习Ubuntu的基础知识。
1、配置eth0的IP地址,同时激活该设备:
#ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up
2、配置eth0别名设备eth0:1,并添加路由:
#ifconfig eth0 192.168.1.3 #route add –host 192.168.1.3 dev eth0:
3、激活设备:
#ifconfig eth0 up
4、禁用设备:
#ifconfig eth0 down
5、查看指定网络接口配置及查看所有网络接口配置:
#ifconfig eth0 //查看eth0网络配置
#ifconfig //查看所有设备的网络配置
route:可以使用route命令配置并查看内核路由表的配置情况。
1、添加到主机的路由:
#route add –host 192.168.1.2 dev eth0:
#route add –host 10.20.30.148 gw 10.20.30.40
2、添加到网络的路由:
#route add –net 10.20.30.40 netmask 255.255.255.248 eth0
#route add –net 10.20.30.48 netmask 255.255.255.248 gw 10.20.30.41
#route add –net 192.168.1.0/ eth1
3、添加默认网关及查看路由表:
#route add default gw 192.168.1.1
#route
4、删除路由:
#route del –host 192.168.1.2 dev eth0:
#route del –host 10.20.30.148 gw 10.20.30.40
#route del –net 10.20.30.40 netmask 255.255.255.248 eth0
#route del –net 10.20.30.48 netmask 255.255.255.248 gw 10.20.30.41
#route del –net 192.168.1.0/ eth1
#route del default gw 192.168.1.1
对于以上操作可使用下面的语句实现:
I
ifconfig eth0 172.16.19.71 netmask 255.255.255.0 route 0.0.0.0 gw 172.16.19.254 service network restart
traceroute:显示数据包到达目的主机经过的路由。
#traceroute x
ping :测试网络的连通性。
#ping x
#ping –c 192.168.1.12
netstat:显示网络状态信息。
arp:配置并查看arp缓存。
查看arp缓存。
#arp
添加一个IP地址和MAC地址的对应记录。
#arp –s 192.168.33.15 ::::CE:B2
删除一个IP地址和MAC地址的对应缓存记录。
#arp –d192.168.33.
Ubuntu命令行下的网络配置
编辑 /etc/network/interface:
auto lo
iface lo inet loopback
auto eth0
如果是自动获取ip,添加
iface eth0 inet dhcp
如果是手动配置ip,添加
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
network xxx.xxx.xxx.xxx
boardcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
tags:命令,网络,Ubuntu
ubuntu网络配置相关知识(转载)的更多相关文章
- linux网络配置相关命令、虚拟网络接口eth0:0
网络接口(interface)是网络硬件设备在操作系统中的表示方法,比如网卡在Linux操作系统中用ethX,是由0开始的正整数,比如eth0.eth1...... ethX.而普通猫和ADSL的接口 ...
- linux网络配置相关文件
网络接口(interface)是网络硬件设备在操作系统中的表示方法,比如网卡在Linux操作系统中用ethX,是由0开始的正整数,比如eth0.eth1...... ethX.而普通猫和ADSL的接口 ...
- ubuntu网络配置命令
Ubuntu网络配置例如: (1) 配置eth0的IP地址, 同时激活该设备. #ifconfig eth0 192.168.1.10 netmask 255.255.255.0 up (2) 配置e ...
- 红帽学习笔记[RHCSA] 第七课[网络配置相关]
第七课[网络配置相关] 在Vmware中添加网卡 编辑 -> 编辑虚拟网络 -> 添加网络->随便选择一个如VMnet2-> 选择仅主机模式 -> 勾掉使用本地DHCP服 ...
- ubuntu网络配置
本文介绍ubuntu中的网络配置方法. ubuntu需要在/etc/network/interfaces文件中设置网络配置,基本的格式如下: auto <网卡名> iface <网卡 ...
- Linux网络配置相关
路由相关 #添加到主机的路由 route add -host 192.168.1.2 dev eth0 route add -host 192.168.1.2 gw 192.168.1.1 注1:添加 ...
- ubuntu 网络配置
检查网络配置命令:ifconfig 一.通过配置文件配置 新手没怎么用过Ubuntu,所以走了不少弯路,网上找了很多方法,大都没对我起到帮助作用,所以把自己的配置方法写一写. Ubuntu上连了两块网 ...
- ubuntu网络配置及端口名修改
一.网络配置文件 buntu系统进行网络配置有的时候用图形界面不起作用,这种情况下可以直接修改某些启动脚本或配置文件 Ubuntu系统进行网络配置涉及到几个配置文件1./etc/network/int ...
- Ubuntu网络配置IP和DNS等,适用于14.04,16.04和17.10
本文主要介绍Ubuntu系统的网络设置,包括IP,DNS和主机名等,适用于14.04,16.04和17.10等版本 =============== 完美的分割线 ================ = ...
随机推荐
- (转) OpenCV学习笔记大集锦 与 图像视觉博客资源2之MIT斯坦福CMU
首页 视界智尚 算法技术 每日技术 来打我呀 注册 OpenCV学习笔记大集锦 整理了我所了解的有关OpenCV的学习笔记.原理分析.使用例程等相关的博文.排序不分先后,随机整理的 ...
- Java theory and practice
This content is part of the series: Java theory and practice A brief history of garbage collection A ...
- Firefox-常用扩展
抓包: HttpFox,相比 Firebug 在页面跳转或刷新时依旧保持原有数据 常用User-Agent模拟: User Agent Switcher 更改请求头: ModifyHeaders 更改 ...
- jquery-easyui中表格的行编辑功能
datagrid现在具有行编辑能力了,使用时只须在columns中为需要编辑的列添加一个editor属性,编辑保存时同时具有数据校验能力. 看一个例子效果图: 代码如下: $('#tt').datag ...
- mysql join的方式结果集
一张图说明 left join, right join, inner join, full outer join
- C#-提取网页中的超链接
转载:http://www.wzsky.net/html/Program/net/26849.htmlusing System; using System.Xml; using System.Text ...
- Android Studio--学习系列(1)
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="ht ...
- jquery.find()
http://www.365mini.com/page/jquery-find.htm
- C# winform 右下角弹出窗口结果
using System.Runtime.InteropServices; [DllImport("user32")] private static extern bool Ani ...
- Eclipse的中文字体设置
打开eclipse中文字体很小,简直难以辨认.在网上搜索发现这是由于Eclipse 用的字体是 Consolas,显示中文的时候默认太小了.解决方式有两种:一.把字体设置为Courier New 操 ...