作者starlin2 (找房子找房子找房子~)
看板Linux
标题[问题] 如何在有proxy的情况下开分享AP给手机用?
时间Fri Feb 15 18:43:24 2019
大家好,新年快乐,不好意思我又来问关於网路设定的问题了。
先说一下目的:
想要将目前的有线网路用本机的wlan开AP给手机上网。
现在的做法是直接安装create_ap,
https://github.com/oblique/create_ap
装好後可以正常用手机连上AP,但不能上网,
因为敝司连网是必须透过proxy才能连出去的,
後来在手机端发现WiFi连线那边可以设定proxy,
但是手机上Wifi设定那边有写到
"浏览器会使用HTTP Proxy,但其他应用程式不一定会采用这项设定"
而实际使用也是如此,用chrome可以正常上网,
但LINE就不能连上,
後来study了好久,似乎可以用iptables来设定让分享的AP透过proxy出去?
不过研究了好久还是不会用,所以上来看看有没有那位大大知道要怎麽设定的?
以下是iptables的设定:
在开AP之前用iptables -L & iptables -t nat -L都是空的
开了之後用ifconfig看会多一个ap0,iptables也多好几个
server:~$ ifconfig
ap0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.12.1 netmask 255.255.255.0 broadcast 192.168.12.255
inet6 fe80::faa2:d6ff:febd:5c6e prefixlen 64 scopeid 0x20<link>
ether f8:a2:d6:bd:5c:6e txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 33 bytes 5084 (5.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
server:~$ sudo iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
ACCEPT udp -- anywhere anywhere udp dpt:bootps
ACCEPT udp -- anywhere anywhere udp dpt:mdns
ACCEPT tcp -- anywhere anywhere tcp dpt:mdns
Chain FORWARD (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere 192.168.12.0/24
ACCEPT all -- 192.168.12.0/24 anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
server:~$ sudo iptables -t nat -L
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
REDIRECT udp -- 192.168.12.0/24 server udp dpt:domain
redir ports 5353
REDIRECT tcp -- 192.168.12.0/24 server tcp dpt:domain
redir ports 5353
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- 192.168.12.0/24 anywhere
然後我的proxy是
http://10.110.11.12:8080/
不知道是否能用iptables去指定这个AP是透过proxy去传输?
可以的话要如何设定才能顺利做到这个功能呢?
以上,感谢收看以及协助的大大喔!
--
寻找理想中的房子~
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 59.124.231.69
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Linux/M.1550227410.A.091.html
1F:推 blackbox: http proxy可以通?line电脑版有proxy可以设定 02/15 20:05
2F:→ blackbox: 手机的话要用vpn形式去钻 02/15 20:07
3F:→ blackbox: 你隔了一层nat,试试看ssh tunnel能不能用 02/15 20:09
4F:→ starlin2: 不是很了解要怎麽试....>< 02/18 17:03
5F:→ starlin2: 刚试着在手机装上ssh tunnel,不过不能连.... 02/18 17:27
6F:→ starlin2: 对了,我知道line电脑版可以设定proxy,但手机的没有。 02/18 17:27
7F:→ starlin2: 更新一下,试了好几个VPN,最後用Ultimate VPN 02/18 17:45
8F:→ starlin2: 连到一个TCP的server後可以用了....^^ 02/18 17:46
10F:→ blackbox: 这样可以开一个8888转到proxy去 02/18 20:14
11F:推 blackbox: linux直接走全域proxy的话,NAT这边会不会一起走? 02/18 20:22
12F:→ blackbox: 有开ip forwarding的话,应该会直接连到proxy 02/18 20:29
13F:→ blackbox: 其实是http proxy不给line用吧 02/18 20:29
14F:→ anakinsean: Google 找一下 transparent proxy 02/20 22:04