eth0down
Ⅰ 如何查看linux系统的网络接口
方法/步骤
1、进入linux,使用“ cat /etc/services ”命令,可以查看所有服务默认的端口列表信息。
Ⅱ 如何通过命令将网卡eth0的状态改为down
eth0是指你的一块网卡或者第一块网卡,down停止的意思 ifconfig是列出网络信息的意思这个命令是 禁用etho网卡 的意思
Ⅲ linux 从DHCP重新获取IP地址的命令是什么
可用指令如下:
1、servicenetworkrestart:重启服务
2、ifconfigeth0down;ifconfigeth0up:对网卡进行操作
3、sudo dhclient -r//release ip:释放IP
4、sudo dhclient//:获取IP
(3)eth0down扩展阅读:
linux常用命令及技巧
1、date :print or set the system date and time
2、 stty -a: 可以查看或者打印控制字符(Ctrl-C, Ctrl-D, Ctrl-Z等)
3、passwd: print or set the system date and time (用passwd -h查看)
4、logout, login: 登录shell的登录和注销命令
5、pwd: print working directory
6、more, less, head tail: 显示或部分显示文件内容.
7、lp/lpstat/cancel, lpr/lpq/lprm: 打印文件.
8、更改文件权限: chmod u+x..
9、删除非空目录:rm -fr dir
10、拷贝目录: cp -R dir
11、fg jobid :可以将一个后台进程放到前台。
Ⅳ Linux中ifconfig命令作用有哪些
linux中ifconfig命令属于网络配置命令
ifconfig命令被用于配置和显示Linux内核中网络接口的网络参数。用ifconfig命令配置的网卡信息,在网卡重启后机器重启后,配置就不存在。要想将上述的配置信息永远的存的电脑里,那就要修改网卡的配置文件了。
语法
ifconfig(参数)
参数
add<地址>:设置网络设备IPv6的ip地址;
del<地址>:删除网络设备IPv6的IP地址;
down:关闭指定的网络设备;
<hw<网络设备类型><硬件地址>:设置网络设备的类型与硬件地址;
io_addr<I/O地址>:设置网络设备的I/O地址;
irq<IRQ地址>:设置网络设备的IRQ;
media<网络媒介类型>:设置网络设备的媒介类型;
mem_start<内存地址>:设置网络设备在主内存所占用的起始地址;
metric<数目>:指定在计算数据包的转送次数时,所要加上的数目;
mtu<字节>:设置网络设备的MTU;
netmask<子网掩码>:设置网络设备的子网掩码;
tunnel<地址>:建立IPv4与IPv6之间的隧道通信地址;
up:启动指定的网络设备;
-broadcast<地址>:将要送往指定地址的数据包当成广播数据包来处理;
-pointopoint<地址>:与指定地址的网络设备建立直接连线,此模式具有保密功能;
-promisc:关闭或启动指定网络设备的promiscuous模式;
IP地址:指定网络设备的IP地址;
网络设备:指定网络设备的名称。
使用功能示例
启动关闭指定网卡:
ifconfig eth0 up
ifconfig eth0 down
ifconfig eth0 up为启动网卡eth0,ifconfig eth0 down为关闭网卡eth0。ssh登陆linux服务器操作要小心,关闭了就不能开启了,除非你有多网卡。
为网卡配置和删除IPv6地址:
ifconfig eth0 add 33ffe:3240:800:1005::2/64 #为网卡eth0配置IPv6地址
ifconfig eth0 del 33ffe:3240:800:1005::2/64 #为网卡eth0删除IPv6地址
用ifconfig修改MAC地址:
ifconfig eth0 hw ether 00:AA:BB:CC:dd:EE
配置IP地址:
[root@localhost ~]# ifconfig eth0 192.168.2.10
[root@localhost ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0
[root@localhost ~]# ifconfig eth0 192.168.2.10 netmask 255.255.255.0 broadcast 192.168.2.255
启用和关闭arp协议:
ifconfig eth0 arp #开启网卡eth0 的arp协议
ifconfig eth0 -arp #关闭网卡eth0 的arp协议
设置最大传输单元:
ifconfig eth0 mtu 1500 #设置能通过的最大数据包大小为 1500 bytes
Ⅳ linux 测试主机是否有可能未全速运行的网络接口
linux一般使用ifconfig命令修改linux主机的ip、网关或子网掩码。
1.命令格式:
ifconfig [网络设备] [参数]
2.命令功能:
ifconfig 命令用来查看和配置网络设备。当网络环境发生改变时可通过此命令对网络进行相应的配置。
3.命令参数:
up 启动指定网络设备/网卡。
down 关闭指定网络设备/网卡。该参数可以有效地阻止通过指定接口的IP信息流,如果想永久地关闭一个接口,我们还需要从核心路由表中将该接口的路由信息全部删除。
arp 设置指定网卡是否支持ARP协议。
-promisc 设置是否支持网卡的promiscuous模式,如果选择此参数,网卡将接收网络中发给它所有的数据包
-allmulti 设置是否支持多播模式,如果选择此参数,网卡将接收网络中所有的多播数据包
-a 显示全部接口信息
-s 显示摘要信息(类似于 netstat -i)
add 给指定网卡配置IPv6地址
del 删除指定网卡的IPv6地址
配置网卡最大的传输单元
mtu 设置网卡的最大传输单元 (bytes)
netmask 设置网卡的子网掩码。掩码可以是有前缀0x的32位十六进制数,也可以是用点分开的4个十进制数。如果不打算将网络分成子网,可以不管这一选项;如果要使用子网,那么请记住,网络中每一个系统必须有相同子网掩码。
tunel 建立隧道
dstaddr 设定一个远端地址,建立点对点通信
-broadcast 为指定网卡设置广播协议
-pointtopoint 为网卡设置点对点通讯协议
multicast 为网卡设置组播标志
address 为网卡设置IPv4地址
txqueuelen 为网卡设置传输列队的长度
4.使用实例:
实例1:显示网络设备信息(激活状态的)
命令:
ifconfig
输出:
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:20
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0
TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB)
说明:
eth0 表示第一块网卡, 其中 HWaddr 表示网卡的物理地址,可以看到目前这个网卡的物理地址(MAC地址)是 00:50:56:BF:26:20
inet addr 用来表示网卡的IP地址,此网卡的 IP地址是 192.168.120.204,广播地址, Bcast:192.168.120.255,掩码地址Mask:255.255.255.0
lo 是表示主机的回坏地址,这个一般是用来测试一个网络程序,但又不想让局域网或外网的用户能够查看,只能在此台主机上运行和查看所用的网络接口。比如把 HTTPD服务器的指定到回坏地址,在浏览器输入 127.0.0.1 就能看到你所架WEB网站了。但只是您能看得到,局域网的其它主机或用户无从知道。
第一行:连接类型:Ethernet(以太网)HWaddr(硬件mac地址)
第二行:网卡的IP地址、子网、掩码
第三行:UP(代表网卡开启状态)RUNNING(代表网卡的网线被接上)MULTICAST(支持组播)MTU:1500(最大传输单元):1500字节
第四、五行:接收、发送数据包情况统计
第七行:接收、发送数据字节数统计信息。
实例2:启动关闭指定网卡
命令:
ifconfig eth0 up
ifconfig eth0 down
输出:
说明:
ifconfig eth0 up 为启动网卡eth0 ;ifconfig eth0 down 为关闭网卡eth0。ssh登陆linux服务器操作要小心,关闭了就不能开启了,除非你有多网卡。
实例3:为网卡配置和删除IPv6地址
命令:
ifconfig eth0 add 33ffe:3240:800:1005::2/64
ifconfig eth0 del 33ffe:3240:800:1005::2/64
输出:
说明:
ifconfig eth0 add 33ffe:3240:800:1005::2/64 为网卡eth0配置IPv6地址;
ifconfig eth0 add 33ffe:3240:800:1005::2/64 为网卡eth0删除IPv6地址;
练习的时候,ssh登陆linux服务器操作要小心,关闭了就不能开启了,除非你有多网卡。
实例4:用ifconfig修改MAC地址
命令:
ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE
输出:
[root@localhost ~]# ifconfig eth0 down //关闭网卡
[root@localhost ~]# ifconfig eth0 hw ether 00:AA:BB:CC:DD:EE //修改MAC地址
[root@localhost ~]# ifconfig eth0 up //启动网卡
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:AA:BB:CC:DD:EE
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0
TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB)
[root@localhost ~]# ifconfig eth0 hw ether 00:50:56:BF:26:20 //关闭网卡并修改MAC地址
[root@localhost ~]# ifconfig eth0 up //启动网卡
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:20
inet addr:192.168.120.204 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8700857 errors:0 dropped:0 overruns:0 frame:0
TX packets:31533 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:596390239 (568.7 MiB) TX bytes:2886956 (2.7 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:68 errors:0 dropped:0 overruns:0 frame:0
TX packets:68 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:2856 (2.7 KiB) TX bytes:2856 (2.7 KiB)
说明:
实例5:配置IP地址
命令:
输出:
[root@localhost ~]# ifconfig eth0 192.168.120.56
[root@localhost ~]# ifconfig eth0 192.168.120.56 netmask 255.255.255.0
[root@localhost ~]# ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255
说明:
ifconfig eth0 192.168.120.56
给eth0网卡配置IP地:192.168.120.56
ifconfig eth0 192.168.120.56 netmask 255.255.255.0
给eth0网卡配置IP地址:192.168.120.56 ,并加上子掩码:255.255.255.0
ifconfig eth0 192.168.120.56 netmask 255.255.255.0 broadcast 192.168.120.255
/给eth0网卡配置IP地址:192.168.120.56,加上子掩码:255.255.255.0,加上个广播地址: 192.168.120.255
实例6:启用和关闭ARP协议
命令:
ifconfig eth0 arp
ifconfig eth0 -arp
输出:
[root@localhost ~]# ifconfig eth0 arp
[root@localhost ~]# ifconfig eth0 -arp
说明:
ifconfig eth0 arp 开启网卡eth0 的arp协议;
ifconfig eth0 -arp 关闭网卡eth0 的arp协议;
实例7:设置最大传输单元
命令:
ifconfig eth0 mtu 1500
输出:
[root@localhost ~]# ifconfig eth0 mtu 1480
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:1F
inet addr:192.168.120.203 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1480 Metric:1
RX packets:8712395 errors:0 dropped:0 overruns:0 frame:0
TX packets:36631 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:597062089 (569.4 MiB) TX bytes:2643973 (2.5 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:9973 errors:0 dropped:0 overruns:0 frame:0
TX packets:9973 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:518096 (505.9 KiB) TX bytes:518096 (505.9 KiB)
[root@localhost ~]# ifconfig eth0 mtu 1500
[root@localhost ~]# ifconfig
eth0 Link encap:Ethernet HWaddr 00:50:56:BF:26:1F
inet addr:192.168.120.203 Bcast:192.168.120.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:8712548 errors:0 dropped:0 overruns:0 frame:0
TX packets:36685 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:597072333 (569.4 MiB) TX bytes:2650581 (2.5 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:9973 errors:0 dropped:0 overruns:0 frame:0
TX packets:9973 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:518096 (505.9 KiB) TX bytes:518096 (505.9 KiB)
[root@localhost ~]#
说明:
设置能通过的最大数据包大小为 1500 bytes
备注:用ifconfig命令配置的网卡信息,在网卡重启后机器重启后,配置就不存在。要想将上述的配置信息永远的存的电脑里,那就要修改网卡的配置文件了。
Ⅵ ETH接口是什么
ETH接口指的是接口,是目前应用最广泛的局域网通讯方式,同时也是一种协议。而以太网接口就是网络数据连接的端口。
以太网的每个版本都有电缆的最大长度限制(即无须放大的长度),这个范围内的信号可以正常传播,超过这个范围信号将无法传播。
为了允许建设更大的网络,可以用中继器把多条电缆连接起来。中继器是一个物理层设备,它能接收、放大并在两个方向上重发信号。
(6)eth0down扩展阅读
几种常见的以太网接口类型。
1、SC光纤接口
SC光纤接口在100Base-TX以太网时代就已经得到了应用,因此当时称为100Base-FX(F是光纤单词fiber的缩写),不过当时由于性能并不比双绞线突出但是成本却较高,因此没有得到普及,现在业界大力推广千兆网络,SC光纤接口则重新受到重视。
2、RJ-45接口
这种接口就是我们现在最常见的网络设备接口,俗称“水晶头”,专业术语为RJ-45连接器,属于双绞线以太网接口类型。RJ-45插头只能沿固定方向插入,设有一个塑料弹片与RJ-45插槽卡住以防止脱落。
3、FDDI接口
FDDI是目前成熟的LAN技术中传输速率最高的一种,具有定时令牌协议的特性,支持多种拓扑结构,传输媒体为光纤。光纤分布式数据接口(FDDI)是由美国国家标准化组织(ANSI)制定的在光缆上发送数字信号的一组协议。
参考资料来源:网络-以太网接口
Ⅶ ifconfig配置ip
一、ifconfig与IP
1、ifconfig添加或修改原IP
ifconfig eth0 192.168.10.199 或
ifconfig eth0 192.168.10.199 netmask 255.255.255.0 up
ifconfig eth0:1 192.168.10.198 netmask 255.255.255.0 up
注:以上两台效果是一样的,上面一种写法是下面一种写法的减缩版。如果eth0上之前已经配置这IP,该配置会将原来的IP清掉,换成上面配置的IP,但在远程ssh时最好不要使用该方法,因为网络环境不同。一旦更改不生效,就要跑到机房再进行配置。
2、禁用启用网卡
ifconfig eth0 down
ifconfig eth0 up
该用法,是不是和ifup eth0、ifdown eth0:1很像?
注:当一块网卡上配置多个IP时,如eth0、eth0:1时,如果禁掉eth0:1时,eth0上的网卡配置依然生效。但禁掉直接物理网卡口时(即eth0)时,其后面配置的IP (eth0:1等)都将被删除掉。另外,ifconfig 还可以用于设置mtu和设置网卡的混杂模式:
ifconfig eth0 mtu 1472
利用netstat -i查看
将eth0设置成混杂模式
ifconfig eth0 promisc
取消混杂
ifconfig eth0 -promisc
3、修改网卡mac地址:
ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
ifconfig查看的信息里,经常被我们忽视的第三行非常有用,如在没有mii-tool工具时,可以通过其查看网卡连接状态。
UP(代表网卡开启状态)RUNNING(代表网卡的网线被接上)MULTICAST(支持组播)MTU:1500(最大传输单元):1500字节
二、ip命令与IP
ip是iproute2软件包里面的一个强大的网络配置工具,它能够替代一些传统的网络管理工具,例如ifconfig、route等,使用权限为超级用户。
1、ip命令添加一个IP地址:
[root@localhost ~]# ip addr add 192.168.10.198/24 dev eth0:1
[root@localhost ~]# ip addr add 192.168.10.199/24 dev eth0
[root@localhost ~]# ip -f inet addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
inet 192.168.10.26/24 brd 192.168.10.255 scope global eth0
inet 192.168.10.198/24 scope global secondary eth0
inet 192.168.10.199/24 scope global secondary eth0
[root@localhost ~]# ip addr add 192.168.10.200/24 dev eth0:3
[root@localhost ~]# ip -f inet addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
inet 192.168.10.26/24 brd 192.168.10.255 scope global eth0
inet 192.168.10.198/24 scope global secondary eth0
inet 192.168.10.199/24 scope global secondary eth0
inet 192.168.10.200/24 scope global secondary eth0
当然,上面的增加地址的写法,我们也可以使用以下两种方式增加,不过由于没有上面的写法容易记,我平时很少会用下面的方式增加:
ip addr add local 192.168.4.1/28 brd + label eth0:1 dev eth0
ip addr add 192.168.4.2/24 brd + dev eth1 label eth1:1
由上面的操作命令不难看出,随便我们怎么去添加IP,后面的设备名无论是eth0、eth0:1、eth0:100也好,其都不会将原网卡上绑定的地址给清掉。其通过ip addr show 显示的出的结果都是secondary eth0 。
注:ip addr命令增加的IP ,不能通过ifconfig查看到,也不能通过ifconfig eth0:1 down 或ifdown eth0:1 这样的方式停掉。
2、ip命令删除一个IP
[root@localhost ~]# ip addr del 192.168.10.200
Not enough information: "dev" argument is required.
[root@localhost ~]# ip addr del 192.168.10.200 dev eth0
Warning: Executing wildcard deletion to stay compatible with old scripts.
Explicitly specify the prefix length (192.168.10.200/32) to avoid this warning.
This special behaviour is likely to disappear in further releases,
fix your scripts!
[root@localhost ~]# ip addr show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 40:61:86:98:95:05 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.26/24 brd 192.168.10.255 scope global eth0
inet 192.168.10.198/24 scope global secondary eth0
inet 192.168.10.199/24 scope global secondary eth0
inet6 fe80::4261:86ff:fe98:9505/64 scope link
valid_lft forever preferred_lft forever
3: sit0: <NOARP> mtu 1480 qdisc noop
link/sit 0.0.0.0 brd 0.0.0.0
[root@localhost ~]# ip addr del 192.168.10.199/24 dev eth0
在不加掩码删除时,其会提示警告,但还是可以将其地址删掉。ip命令的用法比较多,就不一一列举了。
三、路由配置
增加路由
route add -net 192.168.6.0/24 gw 192.168.101.254
route add default gw 192.168.101.254
查看路由
ip route list
route –n
netstat –r
四、总结
以上的ifconfig和ip命令配置的信息,重启都会清除,想要永久生效,还是配置相关的配置文件。不过掌握命令配置方法很重要,在LVS+keepalive等架构上,浮动IP的变动,很多都是通过ip命令来完成的。
Ⅷ linux指令---ifconfig eth0 down,要如何解释
eth0是指你的一块网卡或者第一块网卡,down停止的意思 ifconfig是列出网络信息的意思
这个命令是 禁用etho网卡 的意思
Ⅸ Linux中要禁用网卡是:ifconfig eth0 down,那我使用:ifconfig ip地址 down可以吗
不可以,ifconfig
后面必须加网卡名。你可以用ifdown
etho来禁用网卡eth0,如果你的机器只有一块网卡的,你还可以使用service
network
stop来禁掉网卡!如果是redhat
linux的话,你还可以通过system-config-network把激活的eht0禁用。