需求环境:

1、局域网中有一台没有限制的ERP服务器(ubuntu 10.04系统:192.168.11.11);

2、一台机器为受限机器(XP系统:192.168.11.20);

3、受限机(XP)想用局域网中没有限制的服务器(ubuntu)来上网。

所以可以将服务器ubuntu做代理服务器,这样被限制的XP机就可以通过它无限制地上网了。


对没有限制的机器:ubuntu 10.04进行配置,安装squid代理软件;

root@ubuntu:~# apt-get install squid

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  php5-gd libmcrypt4 libjs-mootools libt1-5 php5-mcrypt php5-mysql
  libapache2-mod-php5 php5-common
Use 'apt-get autoremove' to remove them.
The following extra packages will be installed:
  squid-common squid-langpack
Suggested packages:
  squidclient squid-cgi logcheck-database resolvconf winbind
The following NEW packages will be installed:
  squid squid-common squid-langpack
0 upgraded, 3 newly installed, 0 to remove and 193 not upgraded.
Need to get 1,346kB of archives.
After this operation, 8,503kB of additional disk space will be used.
Do you want to continue [Y/n]? y
Fetched 1,346kB in 5s (247kB/s)
Preconfiguring packages ...
Selecting previously deselected package squid-langpack.
(Reading database ... 133556 files and directories currently installed.)
Unpacking squid-langpack (from .../squid-langpack_20100111-1_all.deb) ...
Selecting previously deselected package squid-common.
Unpacking squid-common (from .../squid-common_2.7.STABLE7-1ubuntu12.5_all.deb) .                                                                             ..
Selecting previously deselected package squid.
Unpacking squid (from .../squid_2.7.STABLE7-1ubuntu12.5_i386.deb) ...
Processing triggers for man-db ...
Processing triggers for ureadahead ...
Setting up squid-langpack (20100111-1) ...
Setting up squid-common (2.7.STABLE7-1ubuntu12.5) ...

Setting up squid (2.7.STABLE7-1ubuntu12.5) ...
Creating squid spool directory structure
2013/01/22 22:15:01| Creating Swap Directories

root@ubuntu:~# cd /etc/squid/
root@ubuntu:/etc/squid# vi squid.conf
# add localhost network
acl inside src 192.168.160.0/24

# add http_access inside  

http_access allow inside

root@ubuntu:/etc/squid# service squid start
squid start/running, process 25337

root@ubuntu:~# ifconfig eth0 |grep addr:
          inet addr:192.168.11.11  Bcast:192.168.11.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe67:d63a/64 Scope:Link
root@ubuntu:~# cat /etc/resolv.conf
# Generated by NetworkManager
nameserver 202.101.172.46

XP的只设定以下两行即可:

IP地址:192.168.11.20

子网掩码:255.255.255.0

然后修改Internet Explorer:

右键点击“Internet Explorer” --> "属性" --> "连接" --> "局域网设置" --> 勾选 “为LAN 使用代理服务器(这些设置不会应用于拨号或VPN连接)。”此项,并在“地址”框中输入ubuntu的IP地址:192.168.11.11,“端口”里输入: 3128 ,“确定” 后退出即可。

这样,XP就可以通过ubuntu这个代理服务器进行上网了。

对于其它软件,也要找到它们的代理设置选项,输入ubuntu的代理地址及端口即可。