[问题]在kubuntu下,怎样使用ifconfig为网卡指定网关和DNS?

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
头像
tigerdoo
帖子: 327
注册时间: 2006-11-17 23:02

[问题]在kubuntu下,怎样使用ifconfig为网卡指定网关和DNS?

#1

帖子 tigerdoo » 2007-07-18 19:39

我查了man ifconfig,没有看到关于这个参数的介绍,是不支持么?如果ifconfig不行,别的什么命令可以么?

ps:我只需要shell下使用命令的解决方案,通过GUI的方式就不用说了。
IBM T41-P4M 1.5G/1GB/40GB HDD/DVD/14.1TFT/IPW2100 & 10-100M
OS:Xubuntu 11.10
生活就是折腾
活在成都
使用update-rc.d管理Linux服务
头像
tigerdoo
帖子: 327
注册时间: 2006-11-17 23:02

#2

帖子 tigerdoo » 2007-07-18 22:45

此案无解么?
IBM T41-P4M 1.5G/1GB/40GB HDD/DVD/14.1TFT/IPW2100 & 10-100M
OS:Xubuntu 11.10
生活就是折腾
活在成都
使用update-rc.d管理Linux服务
kumat
帖子: 5
注册时间: 2006-11-29 15:45

#3

帖子 kumat » 2007-07-19 12:38

DNS: /etc/resolv.conf
IP, mask, Gateway: /etc/network/interfaces

If you want to set up gateway for just one shot, try route, for detailed information about the parametres and options pls follow man route.
头像
qianwx
帖子: 730
注册时间: 2006-07-08 14:41

#4

帖子 qianwx » 2007-07-21 15:02

昏~~~难道楼主不知道ifconfig就和windows下的ipconfig一样,仅仅是用来查看网络配置的么?具体配置IP及其相关参数不是用这个命令的。。。。你应该上网搜索一下具体配置方式,不外乎用命令配置,或者直接打开某个配置文件写入参数。。。
头像
mymike
帖子: 69
注册时间: 2007-07-15 23:56
联系:

#5

帖子 mymike » 2007-07-22 18:39

系统->系统管理->网络,选择“连接”,点“属性”,输入你要的IP和网关。
一般DNS会自动查找并设定好。如果要更改,选择“DNS”标签即可。
附件
net.png
net.png (7.52 KiB) 查看 4219 次
我的主页:http://www.mymiker.com
fishcoder
帖子: 1
注册时间: 2008-01-16 10:22

#6

帖子 fishcoder » 2008-05-12 22:57

你可以在自己的目录下建立两个文件,加入你要在两个ip地址之间要交换
这个是第一个的ip的配置信息
auto lo
iface lo inet loopback


iface eth0 inet static
pre-up iptables-restore< /etc/iptables
post-down iptables-restore < /etc/iptables
post-down iptables-save > /etc/iptables
address 222.30.20.45
netmask 255.255.254.0
gateway 222.30.20.1

auto eth1
iface eth1 inet dhcp

auto eth2
iface eth2 inet dhcp

auto ath0
iface ath0 inet dhcp

auto wlan0
iface wlan0 inet dhcp


iface dsl-provider inet ppp
provider dsl-provider

auto eth0
第二个类似

当你要改变的时候需要
root@fishcoder-desktop:/home/fishcoder/bin# cp interfaces.school /etc/network/interfaces
root@fishcoder-desktop:/home/fishcoder/bin# /etc/init.d/networking restart

运行之就应该可以了~
angelus
帖子: 445
注册时间: 2007-08-27 17:31

#7

帖子 angelus » 2008-05-13 14:09

ifconfig是linux的CLI配置以太网工具
可以用来查看网络接口也可以用来配置网络
ifconfig <网络接口> <ip> [<Mask><Broadcast>]
如:ifconfig eth0 192.168.0.1 (命令启动eth0接口,并设置ip为192.168.0.1,子网为255.255.255.0
广播为192.168.0.255 )
当ip地址使用标准A.B.C类地址,子网,广播系统会自动判断,可以省略
如果有需要如:
ifconfig eth0 10.0.0.10 Mask 255.255.255.0 Broadcast 10.0.0.255

最后还需要注意,用ifconfig配置网络是会立即生效的,但重起机器会丢失,需要重新配置
如果需要一次配置就需要改动 /etc/network/interfaces 这个文件!
你能学会世界上所有语言来叫一种鸟的名字,当你知道所有这些名字叫法后,却对这种鸟一无所知~
理查德-费曼
回复