LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 12346|回复: 24

局域网上网终极解决之道

[复制链接]
发表于 2003-4-5 10:01:47 | 显示全部楼层 |阅读模式
在局域网内如何上网曾困恼我许久,为次我发此帖,希望对大家有点帮助。以我自己为例。我是通过学校里的局域网上网的。我的IP为202.101.247.15.(eth0)。首选DNS:202.101.224.68,备用DNS:202.101.226.68。下面为具体步骤:
1.激活使用的网络接口:ifconfig eth0 202.101.247.15 netmask 255.255.255.0 up
2.设置域名服务器(DNS):这要修改/etc/resolv.conf文件。假设我的主机名为www.freebird.com   (随意的)。那么resolv.conf文件如下:
domain freebird.com
nameserver 202.101.224.68
nameserver 202.101.226.68
3.设置本地主机文件/etc/hosts为:
127.0.0.1 localhost       (必不可少的)
202.101.247.15 www.freebird.com freebird
当然你还可以在此加入其他网址和它IP来加快连线的速度。
4.设置路由(最关键的一步):即添加路由和默认的网关,命令如下:
route add -net 202.101.247.0 netmask 255.255.255.0 eth0
route add default gw 202.101.247.15 eth0
如果你想在每次开机后就能上网,那么你要把第4步中的命令写入/etc/rc.local文件中。如果这样还连不上,你就要在设置好这些后,在“网络”中手动激活你的网卡。

  我用此法N次,均成功,祝你好运;) ;) ;)
发表于 2003-4-30 21:10:01 | 显示全部楼层

但我不知道主机怎么办?

但我不知道主机怎么办?比如我也是校园网。IP:10.10.0.6
掩码是:255.255.255.0   网关:10.10.0.254 DSN:211.95.193.97
该怎么设置哦??
发表于 2003-5-1 00:03:22 | 显示全部楼层
/etc/sysconfig/network-scripts/ifcfg-eth0
发表于 2003-9-13 13:01:24 | 显示全部楼层

:(

我按照你的方法设置.

但无法看网页,而nslookup则可以使用,正向和反向解释都成功.

真是奇怪.
发表于 2003-9-16 15:18:00 | 显示全部楼层
你好,我用ipconfig eth0 命令 显示没有找到eth0这个设备,是怎么回事?
昨天用KDE界面上的network选项设好了的,可以上网了,但今天就不行了。
RH8 REALTEK RTL8139 上的是联通的宽带局域网。
 楼主| 发表于 2003-9-16 19:59:25 | 显示全部楼层
应该是ifconfig eth0
是不是eth0视情况而定,用ifconfig -a看看,一般如果只有一块网卡应该就是eth0了
发表于 2003-9-16 20:16:02 | 显示全部楼层

这个是透明代理吗?

如果我的局域网里的机器没有正式的ip地址,能用这种方法让他们都上的了网吗?
发表于 2003-9-17 16:19:17 | 显示全部楼层

回复bird

都在这呢
   ~>ifconfig -a
lo        Link encapocal Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:72 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4682 (4.5 Kb)  TX bytes:4682 (4.5 Kb)

~>>ifconfig eth0
eth0: error fetching interface information: Device not found
~>

"dmesg"
ohci1394: pci_module_init failed
ip_tables: (C) 2000-2002 Netfilter core team
8139cp 10/100 PCI Ethernet driver v0.0.7 (Feb 27, 2002)
8139cp: pci dev 03:05.0 (id 10ec:8139 rev 10) is not an 8139C+ compatible chip
8139cp: Try the "8139too" driver instead.
PCI: Found IRQ 12 for device 00:1f.5
PCI: Sharing IRQ 12 with 00:1f.3
PCI: Sharing IRQ 12 with 03:05.0
PCI: Setting latency timer of device 00:1f.5 to 64
intel8x0: clocking to 48000
Linux agpgart interface v0.99 (c) Jeff Hartmann


Windows 98 IP Configuration



        Host Name . . . . . . . . . : LUCK

        DNS Servers . . . . . . . . : 211.90.8.129

                                      211.94.33.193

        Node Type . . . . . . . . . : Broadcast

        NetBIOS Scope ID. . . . . . :

        IP Routing Enabled. . . . . : No

        WINS Proxy Enabled. . . . . : No

        NetBIOS Resolution Uses DNS : No



0 Ethernet adapter :



        Description . . . . . . . . : PPP Adapter.

        Physical Address. . . . . . : 44-45-53-54-00-00

        DHCP Enabled. . . . . . . . : Yes

        IP Address. . . . . . . . . : 0.0.0.0

        Subnet Mask . . . . . . . . : 0.0.0.0

        Default Gateway . . . . . . :

        DHCP Server . . . . . . . . : 255.255.255.255

        Primary WINS Server . . . . :

        Secondary WINS Server . . . :

        Lease Obtained. . . . . . . :

        Lease Expires . . . . . . . :



1 Ethernet adapter :



        Description . . . . . . . . : Realtek 8139-series PCI NIC                                                      

        Physical Address. . . . . . : 00-E0-4C-8D-8B-B6

        DHCP Enabled. . . . . . . . : Yes

        IP Address. . . . . . . . . : 192.168.1.112

        Subnet Mask . . . . . . . . : 255.255.255.0

        Default Gateway . . . . . . : 192.168.1.1

        DHCP Server . . . . . . . . : 192.168.1.1

        Primary WINS Server . . . . :

        Secondary WINS Server . . . :

        Lease Obtained. . . . . . . : 09 17 03 16:12:01

        Lease Expires . . . . . . . : 09 18 03 16:12:01
 楼主| 发表于 2003-9-17 16:25:25 | 显示全部楼层

回复: 这个是透明代理吗?

最初由 shiquan 发表
如果我的局域网里的机器没有正式的ip地址,能用这种方法让他们都上的了网吗?
没有任何问题,只是你设置好这些后还要在浏览器里面设置相应的代理
发表于 2004-3-28 17:58:08 | 显示全部楼层
不行,我有两块网卡;
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表