pac研究

先贴一个某公司内网的自动代理pac文件

http://autoproxy.XXXXXX.cn/proxy.pac

function FindProxyForURL(url, host)
{
    if (dnsDomainIs(host, "img.99bill.com"))
    {
        return "PROXY 10.199.75.12:8080"; //走代理
    }

    if (dnsDomainIs(host, ".wanda.cn") ||
        dnsDomainIs(host, ".wanda.com.cn") ||
        dnsDomainIs(host, ".wandafilm.com") ||
        dnsDomainIs(host, ".vans-china.com.cn") ||
        dnsDomainIs(host, ".vans-china.cn") ||
        dnsDomainIs(host, ".wandahotels.com") ||
        dnsDomainIs(host, ".wanda-hotel.cn") ||
        dnsDomainIs(host, ".wdghy.com") ||
        dnsDomainIs(host, ".wandacinemas.com") ||
        dnsDomainIs(host, ".wandacinemaline.com") ||
        dnsDomainIs(host, ".wandawl.com") ||
        dnsDomainIs(host, ".wanhaiwl.com") ||
        dnsDomainIs(host, ".wandamoviepark.com") ||
        dnsDomainIs(host, ".ffan.com") ||
        dnsDomainIs(host, ".wanhui.cn") ||
        dnsDomainIs(host, ".99bill.com") ||
        dnsDomainIs(host, ".99bills.com") ||
        dnsDomainIs(host, ".wandafilm-dev.com") ||
        dnsDomainIs(host, ".wandaperformace.com") ||
        isInNet(host, "10.0.0.0", "255.0.0.0") ||
        isInNet(host, "127.0.0.1", "255.255.255.255") ||
        isInNet(host, "169.224.11.0", "255.255.255.0"))
    {
        return "DIRECT";    // 内网直连
    }
    else if (isInNet(myIpAddress(), "10.1.25.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.30.0", "255.255.255.240") ||
        isInNet(myIpAddress(), "10.1.31.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.32.0", "255.255.224.0") ||
        isInNet(myIpAddress(), "10.1.64.0", "255.255.240.0") ||
        isInNet(myIpAddress(), "10.1.92.0", "255.255.255.128") ||
        isInNet(myIpAddress(), "10.1.96.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.126.0", "255.255.254.0") ||
        isInNet(myIpAddress(), "10.1.128.0", "255.255.254.0") ||
        isInNet(myIpAddress(), "10.1.130.0", "255.255.254.0") ||
        isInNet(myIpAddress(), "10.1.154.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.155.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.172.0", "255.255.254.0") ||
        isInNet(myIpAddress(), "10.1.174.0", "255.255.254.0") ||
        isInNet(myIpAddress(), "10.1.182.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.185.0", "255.255.254.0") ||
        isInNet(myIpAddress(), "10.1.196.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.200.0", "255.255.254.0") ||
        isInNet(myIpAddress(), "10.1.215.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.1.239.0", "255.255.255.0") ||
        isInNet(myIpAddress(), "10.155.0.0", "255.255.240.0") ||
        isInNet(myIpAddress(), "10.155.16.0", "255.255.240.0") ||
        isInNet(myIpAddress(), "10.157.0.0", "255.255.128.0"))
    {
        return "DIRECT";  //这些ip外网不走代理
    }
    else if (isInNet(myIpAddress(), "10.0.0.0", "255.0.0.0"))

    {
        return "PROXY 10.199.75.12:8080";   //其他ip外网都走代理
    }

}

如果单网卡内外网同同时访问的话,用三层交换机,同时接内外网路由,交换机设置如下
1、
img.99bill.com
走外网路由;

2、

wanda.cn
wanda.com.cn
wandafilm.com
vans-china.com.cn
vans-china.cn
wandahotels.com
wanda-hotel.cn
wdghy.com
wandacinemas.com
wandacinemaline.com
wandawl.com
wanhaiwl.com
wandamoviepark.com
ffan.com
wanhui.cn
99bill.com
99bills.com
wandafilm-dev.com
wandaperformace.com
10.0.0.0, 255.0.0.0
127.0.0.1, 255.255.255.255
169.224.11.0, 255.255.255.0

走内网路由;

3、其他网站都走外网;

按照1、2、3的优先级;

不过三层交换机只能对ip规则不能对域名,还需研究

标签: none

添加新评论

18luck 365bet 888zhenren aomenduchang aomenjinshayule baijiale bbin beplay bet007 betvictor betway bifa bst hg0088 bwin fenghuangyule jinbobao lebaijia long8 manbet quanxunwang shenbotaiyangcheng tengbohui ule vwin w88 wellbet WilliamHill yulepingtai laohuji