Linux网络配置命令——ifconfig
2011-12-25 10:47
627 查看
无论是Linux 自动安装还是我们手工安装,Linux 都会向你询问有关网络的问题并配置相关的软件。这个用于配置网卡的基本命令就是ifconfig。
在执行ifconfig 命令后,系统将在内核表中设置必要的参数,这样Linux 就知道如何与网络上的网卡通信。ifconfig 命令有以下两种格式:
※ifconfig [interface]
※ifconfig interface [aftype] option | address …
ifconfig 的第一种格式(或使用不带任何参数的ifconfig 命令)可以用来查看当前系统的网络配置情况。
在刚刚安装完系统之后,实际上是在没有网卡或者网络连接的情况下使用Linux,但通过ifconfig 可以使用回绕方式工作,使计算机认为自己工作在网络上。
现在我们运行一下ifconfig 命令,不带参数的ifconfig 命令可以显示当前启动的网络接口,其输出结果为:
[root@machine1 /sbin]#ifconfig
eth0 Link encap:Ethernet Hwaddr 52:54:AB:DD:6F:61
inet addr:210.34.6.89 Bcast:210.34.6.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46299 errors:0 dropped:0 overruns:0 frame:189
TX packets:3057 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:5 Base address:0xece0
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
其中以eth0 为首的部分是本机的以太网卡配置参数,这里显示了网卡在下的设备名/dev/eth0 和硬件的MAC 地址52:54:AB:DD:6F:61,MAC 地址是生产厂家定的,每个网卡拥有的唯一地址。
不过我们可以手工改动网卡的MAC 地址,只要我们在/etc/rc.d/init.d/中的network 中加入:
ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
然后重启,此时再用ifconfig 命令查看一下,我们就会发现网卡的MAC 地址已经变成xx:xx:xx:xx:xx:xx了。
后继 常用网卡ip设置方法:
直接通过setup 进行设置。
配置多个网卡 ifconfig -a 查看网络设备 eth0 / eth1 / lo (回路)。
ifconfig eth1 //设备1
ifconfig eth1 192.168.1.10 netmask 255.255.255.0 //设置网卡子网及ip
man ifconfig
ifconfig --help(T002)
风流终被雨打风吹去……
无论是Linux 自动安装还是我们手工安装,Linux 都会向你询问有关网络的问题并配置相关的软件。这个用于配置网卡的基本命令就是ifconfig。
在执行ifconfig 命令后,系统将在内核表中设置必要的参数,这样Linux 就知道如何与网络上的网卡通信。ifconfig 命令有以下两种格式:
※ifconfig [interface]
※ifconfig interface [aftype] option | address …
ifconfig 的第一种格式(或使用不带任何参数的ifconfig 命令)可以用来查看当前系统的网络配置情况。
在刚刚安装完系统之后,实际上是在没有网卡或者网络连接的情况下使用Linux,但通过ifconfig 可以使用回绕方式工作,使计算机认为自己工作在网络上。
现在我们运行一下ifconfig 命令,不带参数的ifconfig 命令可以显示当前启动的网络接口,其输出结果为:
[root@machine1 /sbin]#ifconfig
eth0 Link encap:Ethernet Hwaddr 52:54:AB:DD:6F:61
inet addr:210.34.6.89 Bcast:210.34.6.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46299 errors:0 dropped:0 overruns:0 frame:189
TX packets:3057 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:5 Base address:0xece0
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
其中以eth0 为首的部分是本机的以太网卡配置参数,这里显示了网卡在下的设备名/dev/eth0 和硬件的MAC 地址52:54:AB:DD:6F:61,MAC 地址是生产厂家定的,每个网卡拥有的唯一地址。
不过我们可以手工改动网卡的MAC 地址,只要我们在/etc/rc.d/init.d/中的network 中加入:
ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
然后重启,此时再用ifconfig 命令查看一下,我们就会发现网卡的MAC 地址已经变成xx:xx:xx:xx:xx:xx了。
后继 常用网卡ip设置方法:
直接通过setup 进行设置。
配置多个网卡 ifconfig -a 查看网络设备 eth0 / eth1 / lo (回路)。
ifconfig eth1 //设备1
ifconfig eth1 192.168.1.10 netmask 255.255.255.0 //设置网卡子网及ip
man ifconfig
ifconfig --help(T002)
网卡上增加一个IP:
ifconfig eth0:1 192.168.0.1 netmask 255.255.255.0
删除网卡的第二个IP地址:
ip addr del 192.168.0.1 dev eth0
在执行ifconfig 命令后,系统将在内核表中设置必要的参数,这样Linux 就知道如何与网络上的网卡通信。ifconfig 命令有以下两种格式:
※ifconfig [interface]
※ifconfig interface [aftype] option | address …
ifconfig 的第一种格式(或使用不带任何参数的ifconfig 命令)可以用来查看当前系统的网络配置情况。
在刚刚安装完系统之后,实际上是在没有网卡或者网络连接的情况下使用Linux,但通过ifconfig 可以使用回绕方式工作,使计算机认为自己工作在网络上。
现在我们运行一下ifconfig 命令,不带参数的ifconfig 命令可以显示当前启动的网络接口,其输出结果为:
[root@machine1 /sbin]#ifconfig
eth0 Link encap:Ethernet Hwaddr 52:54:AB:DD:6F:61
inet addr:210.34.6.89 Bcast:210.34.6.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46299 errors:0 dropped:0 overruns:0 frame:189
TX packets:3057 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:5 Base address:0xece0
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
其中以eth0 为首的部分是本机的以太网卡配置参数,这里显示了网卡在下的设备名/dev/eth0 和硬件的MAC 地址52:54:AB:DD:6F:61,MAC 地址是生产厂家定的,每个网卡拥有的唯一地址。
不过我们可以手工改动网卡的MAC 地址,只要我们在/etc/rc.d/init.d/中的network 中加入:
ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
然后重启,此时再用ifconfig 命令查看一下,我们就会发现网卡的MAC 地址已经变成xx:xx:xx:xx:xx:xx了。
后继 常用网卡ip设置方法:
直接通过setup 进行设置。
配置多个网卡 ifconfig -a 查看网络设备 eth0 / eth1 / lo (回路)。
ifconfig eth1 //设备1
ifconfig eth1 192.168.1.10 netmask 255.255.255.0 //设置网卡子网及ip
man ifconfig
ifconfig --help(T002)
风流终被雨打风吹去……
无论是Linux 自动安装还是我们手工安装,Linux 都会向你询问有关网络的问题并配置相关的软件。这个用于配置网卡的基本命令就是ifconfig。
在执行ifconfig 命令后,系统将在内核表中设置必要的参数,这样Linux 就知道如何与网络上的网卡通信。ifconfig 命令有以下两种格式:
※ifconfig [interface]
※ifconfig interface [aftype] option | address …
ifconfig 的第一种格式(或使用不带任何参数的ifconfig 命令)可以用来查看当前系统的网络配置情况。
在刚刚安装完系统之后,实际上是在没有网卡或者网络连接的情况下使用Linux,但通过ifconfig 可以使用回绕方式工作,使计算机认为自己工作在网络上。
现在我们运行一下ifconfig 命令,不带参数的ifconfig 命令可以显示当前启动的网络接口,其输出结果为:
[root@machine1 /sbin]#ifconfig
eth0 Link encap:Ethernet Hwaddr 52:54:AB:DD:6F:61
inet addr:210.34.6.89 Bcast:210.34.6.127 Mask:255.255.255.128
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:46299 errors:0 dropped:0 overruns:0 frame:189
TX packets:3057 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:100
Interrupt:5 Base address:0xece0
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:3924 Metric:1
RX packets:44 errors:0 dropped:0 overruns:0 frame:0
TX packets:44 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
其中以eth0 为首的部分是本机的以太网卡配置参数,这里显示了网卡在下的设备名/dev/eth0 和硬件的MAC 地址52:54:AB:DD:6F:61,MAC 地址是生产厂家定的,每个网卡拥有的唯一地址。
不过我们可以手工改动网卡的MAC 地址,只要我们在/etc/rc.d/init.d/中的network 中加入:
ifconfig eth0 hw ether xx:xx:xx:xx:xx:xx
然后重启,此时再用ifconfig 命令查看一下,我们就会发现网卡的MAC 地址已经变成xx:xx:xx:xx:xx:xx了。
后继 常用网卡ip设置方法:
直接通过setup 进行设置。
配置多个网卡 ifconfig -a 查看网络设备 eth0 / eth1 / lo (回路)。
ifconfig eth1 //设备1
ifconfig eth1 192.168.1.10 netmask 255.255.255.0 //设置网卡子网及ip
man ifconfig
ifconfig --help(T002)
linux增加/删除虚拟IP地址
网卡上增加一个IP:ifconfig eth0:1 192.168.0.1 netmask 255.255.255.0
删除网卡的第二个IP地址:
ip addr del 192.168.0.1 dev eth0
相关文章推荐
- 【Unix/Linux】【命令】【网络操作工具】网络配置工具——ifconfig命令
- 我使用过的Linux命令之ifconfig - 网络配置命令
- linux网络配置命令之ifconfig、ip和route
- Linux网络配置之ifconfig命令详解案例演示
- Linux 网络配置 ifconfig、ip、netstat 命令的使用
- linux网络配置命令ifconfig,ip route
- ifconfig命令_Linux ifconfig 命令用法详解:配置和显示Linux系统网卡的网络参数
- 网络基础知识、linux路由管理命令(route) 、ip命令、ifconfig命令的使用、linux网卡配置
- Linux网络配置命令——ifconfig
- Linux命令之ifconfig - 网络配置命令
- Linux系统基本网络配置之ifconfig命令
- Linux命令的ifconfig - 网络配置命令
- Linux命令之ifconfig - 网络配置命令
- 11_04_Linux网络配置之四 ifconfig及ip命令详解
- Linux网络配置命令——ifconfig
- 移植完linux-3.4.2内核,启动系统后使用命令ifconfig -a查看网络配置,没有eth0
- linux网络配置命令之ifconfig、ip和route
- linux网络配置命令 ifconfig 、route 、ip 、ip route
- Linux ifconfig命令详解和使用示例(Linux网络参数配置和查看)
- linux网络配置命令之ifconfig、ip和route