I have a Raspberry Pi 3 B+ and a Huawei 3G USB modem. I would like to be able to connect to the internet using the eth0 and wlan0 interface, but all I was able to achieve is to connect via one or the other interface, but not both.
I have setup the configuration to dial into the cell provider, as well as all the steps needed to configure a static ip address and doing all the configuration with the NAT as described in this post: https://www.benfreke.org/201712/raspberry-pi-3g-4g-hotspot/ (scroll to "CREATING A WIFI HOTSPOT"). However, this gives me access to access the internet through the Pi's wireless chip, but I have no way to access the internet through a wired connection using the ethernet (eth0). I would like to be able to do both, access through wlan0 but also when connecting an internet cable to the Pi. How can I achieve this? I can setup accessing the internet through the eth0 network, by simply replacing all the wlan0 configuration by eth0 in the tutorial, but then I don't have access to the wlan0 network. Is there a way to achieve both? Alternatively, I have a Apple's Airport Express wireless router, so if there is a way to configure the Pi so I can simply wire it to the Airport Express and then have the Express do the wireless, that would work too, but it does not seem to work when I follow the tutorial, and replace wlan0 by eth0. The code is all essentially the same as in the tutorial linked here.
I figured it out by simply adding a static_ip eth0 to dhcpcd.conf file and then a dhcp-range for interface=eth0 in the dnsmasq.conf file, and finally adding the following two lines in the iptables.ipv4.nat file
-A FORWARD -i ppp0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
-A FORWARD -i eth0 -o ppp0 -j ACCEPT
I was now able to have internet through ethernet as well Raspberry Pi's wireless chip.
Related
On my windows 10 pro laptop I am running geth in WSL. The problem is I can not seem to get reach my wireless router. I am getting a status of not connected to my router. So the web3J calls returns a can not connect. I setup my geth:
geth --http.port "8545" --http.addr "192.168.1.15" --datadir test-chain-dir --http --dev
I setup eth0 to match my address in my ipv4 settings config in my vethernet adaptor
ifconfig eth0 192.168.1.15 and the mask ifconfig eth0 netmask 255.255.255.0
I also add a route ip route add default via 192.168.1.15
So what am I doing wrong? I also tried adding on the windows side the command to setup portproxy.
Is there some definitive instructions somewhere about setting up geth to work within WSL and able to reach out to the router? I wrote some simple code using web3j running on a android phone that is connected on my local network.
Thanks!
I have an AWS Linux 2 instance, with two interfaces in different subnets, where I installed Openvpn using the 172.23.0.0/24 network. Openvpn is working and I can connect to it. However, from the remote client I can only ping the interface connected to the Internet and the Openvpn tunnel interface which has the 172.23.0.1 address. I can not ping the other interface with the 10.0.0.8 address. From the instance, I can ping all addresses. If I run tcpdump, I can see the packets arriving from the remote client, but the interface does not respond.
I have stoped source and destination check and I have also activated ip forwarding with sysctl -w net.ipv4.ip_forward=1 and even tried sysctl -w net.ipv4.conf.all.proxy_arp=1 and sysctl -w net.ipv4.conf.all.proxy_arp_pvlan=1. This is a brand new instance where the only thing installed is Openvpn. No firewall.
Can not figure this out and would appreciate some help.
On my Mac terminal, I can get my Pi ip address using this command line:
arp -n raspberrypi.local
it return the IP address of the pi.
and then I can absolutely SSH into the raspberry pi using these command lines:
ssh-keygen -R raspberrypi.local
ssh pi#raspberrypi.local
However if I ping the pi, it return request timeout and I also cannot access the vnc viewer.
PING from Network Utility
Everything worked just fine when I first log in to this raspberry pi but then this happened.
A device not responding to ping doesn't mean it has a problem. "Ping" packets (https://it.wikipedia.org/wiki/Internet_Control_Message_Protocol) have to be allowed to reach a destination and the destinations has to be allowed to reply. Usually there's a firewall allowing/denying this kind of traffic.
Assuming the services you're speaking about, are correctly running on the machine (server) you want to connect to:
ssh runs on port 22: a firewall policy need top be in place to allow you (the client) to connect to the server on port 22
vnc runs on port 5900 (and above) according to the configuration: also in this situation, a firewall policy has to be in place to allow you (the client) to connect to the server
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 8 years ago.
Improve this question
Setup PPTP to access home network transparently
I have Raspberry Pi box connected to home WiFi-router and running pptpd. The local addresses is 192.168.1.32 (eth0) and 192.168.2.1 (ppp0) and local name raspberry.local.
I have iMac connected to the same router with local IP 192.168.1.27 and local name imac.local
I have Macbook somewhere in the Internet connected to Raspberry’s PPTP with 192.168.2.10 on ppp0
This picture shows more clearly.
pptpd configuration
PPTP on Raspberry was installed from this simple script.
/etc/pptpd.conf
option /etc/ppp/options.pptpd
logwtmp
localip 192.168.2.1
remoteip 192.168.2.10-100
/etc/ppp/options.pptpd
name pptpd
refuse-pap
refuse-chap
refuse-mschap
require-mschap-v2
require-mppe-128
ms-dns 8.8.8.8
ms-dns 8.8.4.4
proxyarp
lock
nobsdcomp
novj
novjccomp
nologfd
/etc/rc.local
…
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -I INPUT -p tcp --dport 1723 -j ACCEPT
iptables -I INPUT --protocol 47 -j ACCEPT
iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -d 0.0.0.0/0 -o eth0 -j MASQUERADE
iptables -I FORWARD -s 192.168.2.0/24 -p tcp -m tcp --tcp-flags FIN,SYN,RST,ACK SYN -j TCPMSS --set-mss 1356
…
Curent connectivity
Macbook
can connect to home PPTP and connect to Internet through the home router
can connect to iMac and Raspberry via local IPs 192.168.1.27 and 192.168.1.32
can NOT resolve raspberry.local and imac.local
Raspberry
can connect to iMac and Macbook via local IPs 192.168.1.27 and 192.168.2.10
can resolve imac.local
can NOT resolve macbook.local
iMac
can connect to Raspberry via local IP 192.168.1.32
can resolve raspberry.local
can NOT connect to Macbook via local IP 192.168.2.10 (upd: Solved by adding static route to the router)
can NOT resolve macbook.local
The goal
The goal is to connect and resolve local names from any to any. But I have no idea how to configure this: iptables, avahi, netatalk or somewhere else?
These are 2 separate goals and you have to solve them separately.
For resolution to work: You need to set up a DNS server somewhere (iMac?) and designate it as a resolver in all your devices/computers.
Or go with an easier setup, put the name <-> ip address relations into the /etc/hosts file on all your devices/computers
For connectivity: Your iMac simply "does not know" (i.e. no route) how to connect to what is behind the raspberry. However, it DOES work vice-verse since your raspberry is doing NAT for the macbook.
Do you have access to your WiFi router's routing table? If yes, you need to add a route to the PPP network (192.168.2.0/25) via raspberry's external IP address (192.168.1.32).
The exact command or configuration steps, however, depend on the vendor/model of your WiFi router, so I cannot give you a more detailed answer here.
I'm trying to set up a transparent proxy on my Mac OS X Lion (10.7.5), so I can use mitmproxy (to intercept SSL traffic from android applications). I followed the steps in the mitmproxy docs for setting up port forwarding with pf on Mac OS X, and they all went without any errors:
$ sudo sysctl -w net.inet.ip.forwarding=1
Password:
net.inet.ip.forwarding: 0 -> 1
$ sudo pfctl -f pf.conf
No ALTQ support in kernel
ALTQ related functions disabled
$ sudo pfctl -e
No ALTQ support in kernel
ALTQ related functions disabled
pf enabled
But it doesn't seem to have had any effect. When I go to websites in my browser, it makes a direct request, and doesn't go through the port I specified. Here is the pf.conf file (en1 is my wifi):
rdr on en1 inet proto tcp to any port 80 -> 127.0.0.1 port 4500
rdr on en1 inet proto tcp to any port 443 -> 127.0.0.1 port 4500
Thanks for stopping by the IRC channel today. I've tracked this down, and the basic issue is that the rdr rules apply to inbound traffic. This means that they will NOT redirect traffic coming from the box itself. If you think about it, this is inevitable: we can't distinguish between an outbound connection from a non-mitmproxy app, and an outbound connection from mitmproxy itself. We can use route-to to send the traffic to lo0 and then redirect it, but that causes an infinite loop where mitmproxy's own outbound connections are also redirected back to mitmproxy.
Because I know a bit about your use case, I would suggest exploring ways to do this with VirtualBox. A plan of attack would be to set the VirtualBox network up in bridge mode, and then use a pf rule with a match on the source address to redirect traffic to mitmproxy. That should do what you want, and not cause singularities in time and space due to infinite redirection.
Please drop by the IRC channel again if you need a further hand with this.
Did you try net.inet.ip.scopedroute=0? From http://lucumr.pocoo.org/2013/1/6/osx-wifi-proxy/:
Now currently if you finish that above setup you will notice that
nothing actually works. The cause for this is a Bug in the OS X kernel
that requires flipping the net.inet.ip.scopedroute flag to 0. I am not
entirely sure what it does, but the internet reports that it breaks
network sharing through the user preferences. In any case it fixes
ipfw based forwarding so you can flip it with sysctl:
$ sudo sysctl -w net.inet.ip.scopedroute=0
Unfortunately in OS X Lion this flag can actually not be flipped from
userspace so you need to set it as boot parameter and then restart
your computer. You can do this by editing the
/Library/Preferences/SystemConfiguration/com.apple.Boot.plist file
(continued...)
You are using the port 4500 instead the default port 8080.
Do you start mitmproxy with the port specification?: mitmproxy -T --host -p 4500
Did you follow the steps to set the certificate in the Android device? http://mitmproxy.org/doc/certinstall/android.html
Another problem could be the gateway on your android phone: Preferences - Wifi - Hold on the network you are using - Edit network - Advanced options - Set as gateway the ip of your machine with mitmproxy.
By the way I have the same warning with No ALTQ function but it works.