autoeth0不起作用
『壹』 ubuntu ifupdown(eth0)与auto(eth0)有什么区别
这样解释看看 eth0上IP为自动获取
eth1上为手工设置(又是VPC自己要求的)
配置过程:
1、打开Ubuntu的/etc/network/interfaces文件 。默认内容如下:
auto lo
iface lo inet loopback
2、eth0为自动获取IP,所以不需要配置了。插入要手工设置IP的eth1的IP信息,编辑后内容如下,前面auto eth1,让网卡开机自动挂载.:
auto lo
iface lo inet loopback
auto eth1
iface eth1 inet static
address 192.168.0.101
netmask 255.255.255.0
network 192.168.0.0
broadcask 192.168.0.255
gateway 192.168.0.2
3、编写完毕保存,然后打开终端运行如下命令,重新启动网卡即可:
$ /etc/init.d/networking restart
也可以重启网卡让新配置生效,优点是不影响其他网络接口:
$ sudo ifdown eth0
$ sudo ifup eth04、如果以DHCP方式配置网卡,则改为:
auto eth0
iface eth0 inet dhcp
也可以在命令行下直接输入下面的命令来获取地址
sudo dhclient eth0
5、配置DNS服务器的地址,最多可以使用3个DNS服务器
$ sudo vi /etc/resolv.conf
nameserver 202.96.134.133
nameserver 202.96.128.68
nameserver 202.96.128.166
对"resolv.conf"的修改是即时生效的。可以使用nslookup命令进行DNS服务器查询,以验证"resolv.conf"配置文件。
如何查看DNS
$ less /etc/resolv.conf
『贰』 LINUX修改IP,永久生效命令方法
Linux修改IP永久生效的办法就是修改配置文件:
先说临时生效的方法:
ifconfig eth0 192.168.10.24/24
ifconfig 网络设备名称 IP 地址/子网掩码位数
上面上方时临时生效。
下面是永久生效的方法:
修改配置文件:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
HWADDR=00:0C:29:5A:22:EF
TYPE=Ethernet
UUID=53c1c149-e126-443e-93fd-db592deb339e
ONBOOT=yes
NM_CONTROLLED=yes
BOOTPROTO=static #设置静态IP
IPADDR=192.168.10.24
NETMASK=255.255.255.0
BROADCAST=192.168.10.255
GATEWAY=192.168.10.2 #设置你自己的网关
临时+永久 就能达到不重启网卡是想IP地址永久生效了!
『叁』 解决安装完kali系统不能上网的问题
当在Kali系统上遇到无法上网的问题时,首先需要配置网络以实现桥接模式。桥接模式下,虚拟机与物理机共享同一网络环境,但需确保IP地址和网段不同。例如,如果你的物理机IP为192.168.1.34,网关为192.168.1.1,子网掩码为255.255.255.0,Kali系统的网络配置步骤如下:
1. 打开网络接口配置文件
vim /etc/network/interfaces
2. 将网络接口设置为静态IP,修改内容如下:
auto eth0
iface eth0 inet static
address 192.168.1.63
netmask 255.255.255.0
gateway 192.168.1.1
3. 添加DNS服务器,以使用Google的DNS服务为例:
vim /etc/resolv.conf
nameserver 8.8.8.8
4. 保存并关闭文件后,重启网络服务以应用更改:
service networking restart
经过以上步骤,你应该能够解决Kali系统无法上网的问题,使其能够连接网络并正常浏览。
『肆』 ubuntu能ping通网关,但不能ping通外网
下面我重新整理一下:
————————这是 ubuntu的配置:————————————
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
address 192.168.30.253
netmask 255.255.255.0
network 192.168.30.0
broadcast 192.168.30.255
gateway 192.168.30.254
# dns-* options are implemented by the resolvconf package, if installed
dns-nameservers 192.168.30.254
———————这是xp的网络参数———————————————
Windows IP Configuration
Host Name . . . . . . . . . . . . : lenovo
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Realtek RTL8169/8110 Family Gigabit Ethernet NIC
Physical Address. . . . . . . . . : 00-13-22-45-32-8A
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.30.3
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.30.254
DNS Servers . . . . . . . . . . . : 202.103.44.150
————————————————————————————
二楼说的可能是正确的:网关或要ping的服备器对ping命令进行了屏蔽。
无论是在ubuntu还是xp中,ping外网的IP都是失败的!
但是我在xp 下
C:\Documents and Settings\Administrator>telnet 119.147.15.13 25
却能得到服务器响应;
119.147.15.13 是tencent的一个服务器地址,
telnet 119.147.15.13 25的含义是 登录腾讯的 smtp
可我在ubuntu上执行同样的命令却得不到服务器的响应,我觉得ubuntu还是不能连接外网,请问各位高手怎么搞定啊???????
———————————————————————————————
{123.4.45.* 2010-4-29 12:55}******* 的回答是对的,公司的网管把网关的ping给关了。
———————————————————————————————
———————————————————————————————
【 blackfriday13】
(buntu的dns没有设置对,需要在另外的地方配置的)******* 我现在只想网通,对于的DNS的配置,我想在网通后再去设置;
(在XP界面能用putty控制ubuntu——由于是内网,所以不需要通过网关。) ******* 我对“网关”的理解是充当数据中转的中心结点可以称作网关,公司的192.168.30.222这个电脑既为内网间的电脑相互交换数据,又为内网电脑与外网提供链接;
(你不用把xp的ip用在ubuntu上,你只要把网关和dns弄对就可以了)******* 有时候公司的一些IP能上,一些IP能上,我想尽量减少差异才这样做的;
(你提供的win和ubuntu的ip对照是不一样的,ubuntu里是192.168.30.1的网关及dns,而win里确是192.168.30.222的网关,dns是202.103.44.150 )******* 请见本栏提供的配置信息,上面的参数有误,会误导您的帮助!再次谢谢!
———————————————————————————————
『伍』 linux 怎么改网卡ip地址
修改debian的ip地址需要修改配置文件/etc/network/interfaces。
如果是设置成dhcp自动获取ip地址,在配置文件中加入这样的内容:
auto
eth0
iface
eth0
inet
dhcp
然后保存退出,需要重启网络(不是重启主机)使配置生效,重启网络命令:
/etc/init.d/networking
restart
重启网络后,执行dhclient
eth0命令就可以获取ip地址了。
注意:配置文件里的eth0是网卡的名字,需要你自己主机上的网卡名字(无线网卡用iwconfig可以看到,一般有线网卡用ifcongfig可以看到)。
auto
eth0这一句表示开机网卡设置就生效。
如果是设置成静态ip地址,需要写入以下内容:
auto
eth0
iface
eth0
inet
static
address
这里是静态ip
netmask
这里是子网掩码
gateway
这里是网关地址
network
这里是所在网段的网络地址
broadcast
这里是所在网段的广播地址
保存退出后也要重启网络。