Article 6J6J3 Internet sharing between two NICs

Internet sharing between two NICs

by
Jason.nix
from LinuxQuestions.org on (#6J6J3)
Hello,
I have a virtual machine with two NICs as follows:
Quote:
enp0s3: 10.0.2.15
enp0s8: 192.168.1.20
I want to share the internet of the enp0s3 NIC with the enp0s8 NIC. I used the following iptables rules:
Code:$ sudo iptables -I INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
$ sudo iptables -I FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
$ sudo iptables -t nat -I POSTROUTING -o enp0s3 -j MASQUERADEAfter it, when I use the IP address 192.168.1.20 as the default gateway on another machine, then that machine has access to the Internet. This means that the Internet is properly shared, but Why does the following command not work?
Code:$ ping -I enp0s8 8.8.8.8Thank you.
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments