Is there any way to be able to ping from main network (192.168.1.0/24) to subnetwork (192.168.2.0/24)












2














So i take internet from my Raspberry pi 3b+ running Raspbian Stretch Kernel version:4.14, wlan0 and i just create a network bridge to give internet to ethernet adaptor witch will give ip adresses by dhcp when i plug a new computer to it. so i did it and it works but when i try to ping from my main computer witch is on 192.168.1.0/24 to 192.168.2.0/24 network i can't but when i try to ping from 192.168.2.0/24 network to 192.168.1.0/24 i can.Why is that? i want to be able to reach 192.168.2.xxx cuz i want to host a webserver there .Help..



I tried to bridge like this :



sudo apt-get install dnsmasq

sudo nano /etc/dhcpcd.conf:
interface eth0
static ip_address=192.168.2.1/24
static routers=192.168.2.0

sudo nano /etc/network/interfaces:
auto eth0
allow-hotplug eth0
iface eth0 inet static
address 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255

auto wlan0
allow-hotplug wlan0
iface wlan0 inet static
address 192.168.1.10
gateway 192.168.1.1
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

sudo service dhcpcd restart

sudo nano /etc/dnsmasq.conf:
interface=eth0 # Use interface eth0 listen-address=192.168.2.1 # Specify the address to listen on bind-interfaces # Bind to the interface
server=8.8.8.8 # Use Google DNS
domain-needed # Don't forward short names
bogus-priv # Drop the non-routed address spaces.
dhcp-range=192.168.2.10,192.168.2.20,12h # IP range and lease time

sudo nano /etc/sysctl.conf:
net.ipv4.ip_forward=1


sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT`
sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

sudo service dnsmasq start









share|improve this question









New contributor




D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

























    2














    So i take internet from my Raspberry pi 3b+ running Raspbian Stretch Kernel version:4.14, wlan0 and i just create a network bridge to give internet to ethernet adaptor witch will give ip adresses by dhcp when i plug a new computer to it. so i did it and it works but when i try to ping from my main computer witch is on 192.168.1.0/24 to 192.168.2.0/24 network i can't but when i try to ping from 192.168.2.0/24 network to 192.168.1.0/24 i can.Why is that? i want to be able to reach 192.168.2.xxx cuz i want to host a webserver there .Help..



    I tried to bridge like this :



    sudo apt-get install dnsmasq

    sudo nano /etc/dhcpcd.conf:
    interface eth0
    static ip_address=192.168.2.1/24
    static routers=192.168.2.0

    sudo nano /etc/network/interfaces:
    auto eth0
    allow-hotplug eth0
    iface eth0 inet static
    address 192.168.2.1
    netmask 255.255.255.0
    network 192.168.2.0
    broadcast 192.168.2.255

    auto wlan0
    allow-hotplug wlan0
    iface wlan0 inet static
    address 192.168.1.10
    gateway 192.168.1.1
    netmask 255.255.255.0
    network 192.168.1.0
    broadcast 192.168.1.255
    wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

    sudo service dhcpcd restart

    sudo nano /etc/dnsmasq.conf:
    interface=eth0 # Use interface eth0 listen-address=192.168.2.1 # Specify the address to listen on bind-interfaces # Bind to the interface
    server=8.8.8.8 # Use Google DNS
    domain-needed # Don't forward short names
    bogus-priv # Drop the non-routed address spaces.
    dhcp-range=192.168.2.10,192.168.2.20,12h # IP range and lease time

    sudo nano /etc/sysctl.conf:
    net.ipv4.ip_forward=1


    sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
    sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
    sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
    sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT`
    sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

    sudo service dnsmasq start









    share|improve this question









    New contributor




    D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.























      2












      2








      2







      So i take internet from my Raspberry pi 3b+ running Raspbian Stretch Kernel version:4.14, wlan0 and i just create a network bridge to give internet to ethernet adaptor witch will give ip adresses by dhcp when i plug a new computer to it. so i did it and it works but when i try to ping from my main computer witch is on 192.168.1.0/24 to 192.168.2.0/24 network i can't but when i try to ping from 192.168.2.0/24 network to 192.168.1.0/24 i can.Why is that? i want to be able to reach 192.168.2.xxx cuz i want to host a webserver there .Help..



      I tried to bridge like this :



      sudo apt-get install dnsmasq

      sudo nano /etc/dhcpcd.conf:
      interface eth0
      static ip_address=192.168.2.1/24
      static routers=192.168.2.0

      sudo nano /etc/network/interfaces:
      auto eth0
      allow-hotplug eth0
      iface eth0 inet static
      address 192.168.2.1
      netmask 255.255.255.0
      network 192.168.2.0
      broadcast 192.168.2.255

      auto wlan0
      allow-hotplug wlan0
      iface wlan0 inet static
      address 192.168.1.10
      gateway 192.168.1.1
      netmask 255.255.255.0
      network 192.168.1.0
      broadcast 192.168.1.255
      wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

      sudo service dhcpcd restart

      sudo nano /etc/dnsmasq.conf:
      interface=eth0 # Use interface eth0 listen-address=192.168.2.1 # Specify the address to listen on bind-interfaces # Bind to the interface
      server=8.8.8.8 # Use Google DNS
      domain-needed # Don't forward short names
      bogus-priv # Drop the non-routed address spaces.
      dhcp-range=192.168.2.10,192.168.2.20,12h # IP range and lease time

      sudo nano /etc/sysctl.conf:
      net.ipv4.ip_forward=1


      sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
      sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
      sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
      sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT`
      sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

      sudo service dnsmasq start









      share|improve this question









      New contributor




      D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      So i take internet from my Raspberry pi 3b+ running Raspbian Stretch Kernel version:4.14, wlan0 and i just create a network bridge to give internet to ethernet adaptor witch will give ip adresses by dhcp when i plug a new computer to it. so i did it and it works but when i try to ping from my main computer witch is on 192.168.1.0/24 to 192.168.2.0/24 network i can't but when i try to ping from 192.168.2.0/24 network to 192.168.1.0/24 i can.Why is that? i want to be able to reach 192.168.2.xxx cuz i want to host a webserver there .Help..



      I tried to bridge like this :



      sudo apt-get install dnsmasq

      sudo nano /etc/dhcpcd.conf:
      interface eth0
      static ip_address=192.168.2.1/24
      static routers=192.168.2.0

      sudo nano /etc/network/interfaces:
      auto eth0
      allow-hotplug eth0
      iface eth0 inet static
      address 192.168.2.1
      netmask 255.255.255.0
      network 192.168.2.0
      broadcast 192.168.2.255

      auto wlan0
      allow-hotplug wlan0
      iface wlan0 inet static
      address 192.168.1.10
      gateway 192.168.1.1
      netmask 255.255.255.0
      network 192.168.1.0
      broadcast 192.168.1.255
      wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

      sudo service dhcpcd restart

      sudo nano /etc/dnsmasq.conf:
      interface=eth0 # Use interface eth0 listen-address=192.168.2.1 # Specify the address to listen on bind-interfaces # Bind to the interface
      server=8.8.8.8 # Use Google DNS
      domain-needed # Don't forward short names
      bogus-priv # Drop the non-routed address spaces.
      dhcp-range=192.168.2.10,192.168.2.20,12h # IP range and lease time

      sudo nano /etc/sysctl.conf:
      net.ipv4.ip_forward=1


      sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
      sudo iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
      sudo iptables -A FORWARD -i wlan0 -o eth0 -m state --state RELATED,ESTABLISHED -j ACCEPT
      sudo iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT`
      sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"

      sudo service dnsmasq start






      networking ping raspberry-pi






      share|improve this question









      New contributor




      D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question









      New contributor




      D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question








      edited 3 hours ago









      Bob

      45.3k20137171




      45.3k20137171






      New contributor




      D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked 3 hours ago









      D.Poulimenos

      111




      111




      New contributor




      D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      D.Poulimenos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          1 Answer
          1






          active

          oldest

          votes


















          3














          So from what I can tell your current network setup is:




          • One private network of 192.168.1.0/24, let's call this net1

          • A separate private network of 192.168.2.0/24, let's call this net2


          Now, net1 is not a subset of net2. They're actually two separate networks and you'd need to route between them.



          It looks like:




          • Your "main" computer, let's call it pcA, is on net1

          • Your "new" computer, let's call it pcB, is on net2

          • You have a Raspberry Pi that has an address on both net1 and net2.

          • You have the Pi acting as a gateway for net2, and performing NAT such that hosts on net2 (including pcB) can access net1 (and therefore the internet via net1). This is effectively what your typical home NAT router does.


            • This would explain why you can access net1 hosts from net2 but not the other way around.






          Given that setup, you have a few options:




          • You can treat this as any other NAT router (layer 3) and perform port forwarding. In other words, you can forward a port from the Pi's net1 address towards a specific port on a net2 host. For example, assuming the Pi has a net1 address of 192.168.1.10 and pcB has a net2 address of 192.168.2.55, you could forward 192.168.1.10:80 to 192.168.2.55:80. Then, you can access port 80 on pcB from net1 hosts by accessing the Pi's port 80 (192.168.1.10:80).


          • You could bridge (layer 2) the two interfaces on the Pi. This would mean everything is on net1, and net2 does not exist. Everything would be in the 192.168.1.0/24 space and can freely access each other. This would mean your Pi is no longer acting as a router, and you should abandon NAT and disable DHCP and DNS services on the Pi. Everything on the eth0 interface of the Pi would be assigned a net1 address via the DHCP server of net1, via the bridged connection.



          • You could continue to have the two separate networks (layer 3), and continue using NAT for external hosts, but properly route between your internal networks. To do this, you have two options:




            • Currently, your net1 hosts will all hit their default gateway for anything not on the same network. You can continue doing this, and configure the default gateway (probably your generic home router) to forward any net2 destinations to the Pi's net1 address.

            • You could individually configure each net1 host with a static route for net2 destinations to go via the Pi's net1 address. This is a bit more configuration work, but will be faster as packets do not have to be routed through net1's gateway.


            With either of these, you should configure the Pi to not apply NAT to requests with a net1 destination; these should be forwarded without translation.






          Port forwarding is the easiest option with your current setup. But I'd recommend either bridging (if you don't actually need the extra network, this is the cleanest solution) or routing (if you actually need an extra network, e.g. for firewalling purposes) without NAT, as they will give you full access to hosts without having to forward each port individually.






          share|improve this answer





















          • Ok let's say bridging is the best solution and I totally agree there is no reason to have 2 separate networks but how I suppose to do this alrdy search every single post/article about how to bridge wlan0 and eth0 on pi and above configuration works no other does.so I need guidance to achieve a proper bridge from wlan0 witch taked the internet and give it to ethernet
            – D.Poulimenos
            3 hours ago










          • @D.Poulimenos Hm, appears to be a limitation of some wlan adapters. You can kinda emulate it with proxy ARP and routes, but at this point it's questionable whether it's any better than the third option of routing between the networks.
            – Bob
            2 hours ago











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          D.Poulimenos is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1387715%2fis-there-any-way-to-be-able-to-ping-from-main-network-192-168-1-0-24-to-subnet%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          So from what I can tell your current network setup is:




          • One private network of 192.168.1.0/24, let's call this net1

          • A separate private network of 192.168.2.0/24, let's call this net2


          Now, net1 is not a subset of net2. They're actually two separate networks and you'd need to route between them.



          It looks like:




          • Your "main" computer, let's call it pcA, is on net1

          • Your "new" computer, let's call it pcB, is on net2

          • You have a Raspberry Pi that has an address on both net1 and net2.

          • You have the Pi acting as a gateway for net2, and performing NAT such that hosts on net2 (including pcB) can access net1 (and therefore the internet via net1). This is effectively what your typical home NAT router does.


            • This would explain why you can access net1 hosts from net2 but not the other way around.






          Given that setup, you have a few options:




          • You can treat this as any other NAT router (layer 3) and perform port forwarding. In other words, you can forward a port from the Pi's net1 address towards a specific port on a net2 host. For example, assuming the Pi has a net1 address of 192.168.1.10 and pcB has a net2 address of 192.168.2.55, you could forward 192.168.1.10:80 to 192.168.2.55:80. Then, you can access port 80 on pcB from net1 hosts by accessing the Pi's port 80 (192.168.1.10:80).


          • You could bridge (layer 2) the two interfaces on the Pi. This would mean everything is on net1, and net2 does not exist. Everything would be in the 192.168.1.0/24 space and can freely access each other. This would mean your Pi is no longer acting as a router, and you should abandon NAT and disable DHCP and DNS services on the Pi. Everything on the eth0 interface of the Pi would be assigned a net1 address via the DHCP server of net1, via the bridged connection.



          • You could continue to have the two separate networks (layer 3), and continue using NAT for external hosts, but properly route between your internal networks. To do this, you have two options:




            • Currently, your net1 hosts will all hit their default gateway for anything not on the same network. You can continue doing this, and configure the default gateway (probably your generic home router) to forward any net2 destinations to the Pi's net1 address.

            • You could individually configure each net1 host with a static route for net2 destinations to go via the Pi's net1 address. This is a bit more configuration work, but will be faster as packets do not have to be routed through net1's gateway.


            With either of these, you should configure the Pi to not apply NAT to requests with a net1 destination; these should be forwarded without translation.






          Port forwarding is the easiest option with your current setup. But I'd recommend either bridging (if you don't actually need the extra network, this is the cleanest solution) or routing (if you actually need an extra network, e.g. for firewalling purposes) without NAT, as they will give you full access to hosts without having to forward each port individually.






          share|improve this answer





















          • Ok let's say bridging is the best solution and I totally agree there is no reason to have 2 separate networks but how I suppose to do this alrdy search every single post/article about how to bridge wlan0 and eth0 on pi and above configuration works no other does.so I need guidance to achieve a proper bridge from wlan0 witch taked the internet and give it to ethernet
            – D.Poulimenos
            3 hours ago










          • @D.Poulimenos Hm, appears to be a limitation of some wlan adapters. You can kinda emulate it with proxy ARP and routes, but at this point it's questionable whether it's any better than the third option of routing between the networks.
            – Bob
            2 hours ago
















          3














          So from what I can tell your current network setup is:




          • One private network of 192.168.1.0/24, let's call this net1

          • A separate private network of 192.168.2.0/24, let's call this net2


          Now, net1 is not a subset of net2. They're actually two separate networks and you'd need to route between them.



          It looks like:




          • Your "main" computer, let's call it pcA, is on net1

          • Your "new" computer, let's call it pcB, is on net2

          • You have a Raspberry Pi that has an address on both net1 and net2.

          • You have the Pi acting as a gateway for net2, and performing NAT such that hosts on net2 (including pcB) can access net1 (and therefore the internet via net1). This is effectively what your typical home NAT router does.


            • This would explain why you can access net1 hosts from net2 but not the other way around.






          Given that setup, you have a few options:




          • You can treat this as any other NAT router (layer 3) and perform port forwarding. In other words, you can forward a port from the Pi's net1 address towards a specific port on a net2 host. For example, assuming the Pi has a net1 address of 192.168.1.10 and pcB has a net2 address of 192.168.2.55, you could forward 192.168.1.10:80 to 192.168.2.55:80. Then, you can access port 80 on pcB from net1 hosts by accessing the Pi's port 80 (192.168.1.10:80).


          • You could bridge (layer 2) the two interfaces on the Pi. This would mean everything is on net1, and net2 does not exist. Everything would be in the 192.168.1.0/24 space and can freely access each other. This would mean your Pi is no longer acting as a router, and you should abandon NAT and disable DHCP and DNS services on the Pi. Everything on the eth0 interface of the Pi would be assigned a net1 address via the DHCP server of net1, via the bridged connection.



          • You could continue to have the two separate networks (layer 3), and continue using NAT for external hosts, but properly route between your internal networks. To do this, you have two options:




            • Currently, your net1 hosts will all hit their default gateway for anything not on the same network. You can continue doing this, and configure the default gateway (probably your generic home router) to forward any net2 destinations to the Pi's net1 address.

            • You could individually configure each net1 host with a static route for net2 destinations to go via the Pi's net1 address. This is a bit more configuration work, but will be faster as packets do not have to be routed through net1's gateway.


            With either of these, you should configure the Pi to not apply NAT to requests with a net1 destination; these should be forwarded without translation.






          Port forwarding is the easiest option with your current setup. But I'd recommend either bridging (if you don't actually need the extra network, this is the cleanest solution) or routing (if you actually need an extra network, e.g. for firewalling purposes) without NAT, as they will give you full access to hosts without having to forward each port individually.






          share|improve this answer





















          • Ok let's say bridging is the best solution and I totally agree there is no reason to have 2 separate networks but how I suppose to do this alrdy search every single post/article about how to bridge wlan0 and eth0 on pi and above configuration works no other does.so I need guidance to achieve a proper bridge from wlan0 witch taked the internet and give it to ethernet
            – D.Poulimenos
            3 hours ago










          • @D.Poulimenos Hm, appears to be a limitation of some wlan adapters. You can kinda emulate it with proxy ARP and routes, but at this point it's questionable whether it's any better than the third option of routing between the networks.
            – Bob
            2 hours ago














          3












          3








          3






          So from what I can tell your current network setup is:




          • One private network of 192.168.1.0/24, let's call this net1

          • A separate private network of 192.168.2.0/24, let's call this net2


          Now, net1 is not a subset of net2. They're actually two separate networks and you'd need to route between them.



          It looks like:




          • Your "main" computer, let's call it pcA, is on net1

          • Your "new" computer, let's call it pcB, is on net2

          • You have a Raspberry Pi that has an address on both net1 and net2.

          • You have the Pi acting as a gateway for net2, and performing NAT such that hosts on net2 (including pcB) can access net1 (and therefore the internet via net1). This is effectively what your typical home NAT router does.


            • This would explain why you can access net1 hosts from net2 but not the other way around.






          Given that setup, you have a few options:




          • You can treat this as any other NAT router (layer 3) and perform port forwarding. In other words, you can forward a port from the Pi's net1 address towards a specific port on a net2 host. For example, assuming the Pi has a net1 address of 192.168.1.10 and pcB has a net2 address of 192.168.2.55, you could forward 192.168.1.10:80 to 192.168.2.55:80. Then, you can access port 80 on pcB from net1 hosts by accessing the Pi's port 80 (192.168.1.10:80).


          • You could bridge (layer 2) the two interfaces on the Pi. This would mean everything is on net1, and net2 does not exist. Everything would be in the 192.168.1.0/24 space and can freely access each other. This would mean your Pi is no longer acting as a router, and you should abandon NAT and disable DHCP and DNS services on the Pi. Everything on the eth0 interface of the Pi would be assigned a net1 address via the DHCP server of net1, via the bridged connection.



          • You could continue to have the two separate networks (layer 3), and continue using NAT for external hosts, but properly route between your internal networks. To do this, you have two options:




            • Currently, your net1 hosts will all hit their default gateway for anything not on the same network. You can continue doing this, and configure the default gateway (probably your generic home router) to forward any net2 destinations to the Pi's net1 address.

            • You could individually configure each net1 host with a static route for net2 destinations to go via the Pi's net1 address. This is a bit more configuration work, but will be faster as packets do not have to be routed through net1's gateway.


            With either of these, you should configure the Pi to not apply NAT to requests with a net1 destination; these should be forwarded without translation.






          Port forwarding is the easiest option with your current setup. But I'd recommend either bridging (if you don't actually need the extra network, this is the cleanest solution) or routing (if you actually need an extra network, e.g. for firewalling purposes) without NAT, as they will give you full access to hosts without having to forward each port individually.






          share|improve this answer












          So from what I can tell your current network setup is:




          • One private network of 192.168.1.0/24, let's call this net1

          • A separate private network of 192.168.2.0/24, let's call this net2


          Now, net1 is not a subset of net2. They're actually two separate networks and you'd need to route between them.



          It looks like:




          • Your "main" computer, let's call it pcA, is on net1

          • Your "new" computer, let's call it pcB, is on net2

          • You have a Raspberry Pi that has an address on both net1 and net2.

          • You have the Pi acting as a gateway for net2, and performing NAT such that hosts on net2 (including pcB) can access net1 (and therefore the internet via net1). This is effectively what your typical home NAT router does.


            • This would explain why you can access net1 hosts from net2 but not the other way around.






          Given that setup, you have a few options:




          • You can treat this as any other NAT router (layer 3) and perform port forwarding. In other words, you can forward a port from the Pi's net1 address towards a specific port on a net2 host. For example, assuming the Pi has a net1 address of 192.168.1.10 and pcB has a net2 address of 192.168.2.55, you could forward 192.168.1.10:80 to 192.168.2.55:80. Then, you can access port 80 on pcB from net1 hosts by accessing the Pi's port 80 (192.168.1.10:80).


          • You could bridge (layer 2) the two interfaces on the Pi. This would mean everything is on net1, and net2 does not exist. Everything would be in the 192.168.1.0/24 space and can freely access each other. This would mean your Pi is no longer acting as a router, and you should abandon NAT and disable DHCP and DNS services on the Pi. Everything on the eth0 interface of the Pi would be assigned a net1 address via the DHCP server of net1, via the bridged connection.



          • You could continue to have the two separate networks (layer 3), and continue using NAT for external hosts, but properly route between your internal networks. To do this, you have two options:




            • Currently, your net1 hosts will all hit their default gateway for anything not on the same network. You can continue doing this, and configure the default gateway (probably your generic home router) to forward any net2 destinations to the Pi's net1 address.

            • You could individually configure each net1 host with a static route for net2 destinations to go via the Pi's net1 address. This is a bit more configuration work, but will be faster as packets do not have to be routed through net1's gateway.


            With either of these, you should configure the Pi to not apply NAT to requests with a net1 destination; these should be forwarded without translation.






          Port forwarding is the easiest option with your current setup. But I'd recommend either bridging (if you don't actually need the extra network, this is the cleanest solution) or routing (if you actually need an extra network, e.g. for firewalling purposes) without NAT, as they will give you full access to hosts without having to forward each port individually.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          Bob

          45.3k20137171




          45.3k20137171












          • Ok let's say bridging is the best solution and I totally agree there is no reason to have 2 separate networks but how I suppose to do this alrdy search every single post/article about how to bridge wlan0 and eth0 on pi and above configuration works no other does.so I need guidance to achieve a proper bridge from wlan0 witch taked the internet and give it to ethernet
            – D.Poulimenos
            3 hours ago










          • @D.Poulimenos Hm, appears to be a limitation of some wlan adapters. You can kinda emulate it with proxy ARP and routes, but at this point it's questionable whether it's any better than the third option of routing between the networks.
            – Bob
            2 hours ago


















          • Ok let's say bridging is the best solution and I totally agree there is no reason to have 2 separate networks but how I suppose to do this alrdy search every single post/article about how to bridge wlan0 and eth0 on pi and above configuration works no other does.so I need guidance to achieve a proper bridge from wlan0 witch taked the internet and give it to ethernet
            – D.Poulimenos
            3 hours ago










          • @D.Poulimenos Hm, appears to be a limitation of some wlan adapters. You can kinda emulate it with proxy ARP and routes, but at this point it's questionable whether it's any better than the third option of routing between the networks.
            – Bob
            2 hours ago
















          Ok let's say bridging is the best solution and I totally agree there is no reason to have 2 separate networks but how I suppose to do this alrdy search every single post/article about how to bridge wlan0 and eth0 on pi and above configuration works no other does.so I need guidance to achieve a proper bridge from wlan0 witch taked the internet and give it to ethernet
          – D.Poulimenos
          3 hours ago




          Ok let's say bridging is the best solution and I totally agree there is no reason to have 2 separate networks but how I suppose to do this alrdy search every single post/article about how to bridge wlan0 and eth0 on pi and above configuration works no other does.so I need guidance to achieve a proper bridge from wlan0 witch taked the internet and give it to ethernet
          – D.Poulimenos
          3 hours ago












          @D.Poulimenos Hm, appears to be a limitation of some wlan adapters. You can kinda emulate it with proxy ARP and routes, but at this point it's questionable whether it's any better than the third option of routing between the networks.
          – Bob
          2 hours ago




          @D.Poulimenos Hm, appears to be a limitation of some wlan adapters. You can kinda emulate it with proxy ARP and routes, but at this point it's questionable whether it's any better than the third option of routing between the networks.
          – Bob
          2 hours ago










          D.Poulimenos is a new contributor. Be nice, and check out our Code of Conduct.










          draft saved

          draft discarded


















          D.Poulimenos is a new contributor. Be nice, and check out our Code of Conduct.













          D.Poulimenos is a new contributor. Be nice, and check out our Code of Conduct.












          D.Poulimenos is a new contributor. Be nice, and check out our Code of Conduct.
















          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1387715%2fis-there-any-way-to-be-able-to-ping-from-main-network-192-168-1-0-24-to-subnet%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Plaza Victoria

          Puebla de Zaragoza

          Musa