LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-01-2023, 02:12 AM   #16
KatrinAlec
Member
 
Registered: Feb 2012
Posts: 116

Rep: Reputation: 13

yes, just like that.

you need to read up on iptables, that does firewall AND SNAT/DNAT

https://www.netfilter.org/documentat...T-HOWTO-6.html
 
1 members found this post helpful.
Old 08-02-2023, 08:30 PM   #17
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,857

Rep: Reputation: 161Reputation: 161
You should create non-zero VLAN interface, such as enp0s3:10.
 
Old 08-05-2023, 02:53 AM   #18
Jason.nix
Member
 
Registered: Feb 2023
Posts: 568

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by KatrinAlec View Post
yes, just like that.

you need to read up on iptables, that does firewall AND SNAT/DNAT

https://www.netfilter.org/documentat...T-HOWTO-6.html
Hello,
Thank you so much for your reply.
You mean something like below:
Code:
# ifconfig
enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.2.15  netmask 255.255.255.0  broadcast 10.0.2.255
        inet6 fe80::a00:27ff:feed:b47c  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:ed:b4:7c  txqueuelen 1000  (Ethernet)
        RX packets 12217  bytes 5488128 (5.2 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7809  bytes 1321293 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

enp0s3:0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 10.0.5.20  netmask 255.0.0.0  broadcast 10.255.255.255
        ether 08:00:27:ed:b4:7c  txqueuelen 1000  (Ethernet)
...

# iptables -t nat -A POSTROUTING -o enp0s3 -j SNAT --to 10.0.5.20
Then:
Code:
# ping -I enp0s3:0 google.com
ping: invalid source address: enp0s3:0
 
Old 08-05-2023, 02:53 AM   #19
Jason.nix
Member
 
Registered: Feb 2023
Posts: 568

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by nini09 View Post
You should create non-zero VLAN interface, such as enp0s3:10.
Hello,
Thank you for your reply.
How?
 
Old 08-07-2023, 08:18 PM   #20
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,857

Rep: Reputation: 161Reputation: 161
> How?
How do you create enp0s3:0?
You use the command, vconfig add enp0s3 10.

Last edited by nini09; 08-07-2023 at 08:25 PM.
 
Old 08-09-2023, 12:57 PM   #21
Jason.nix
Member
 
Registered: Feb 2023
Posts: 568

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by nini09 View Post
> How?
How do you create enp0s3:0?
You use the command, vconfig add enp0s3 10.
Hello,
Thank you for your reply.
I did:
Code:
# touch /etc/network/interfaces.d/ifcfg-enp0s3:0
# nano /etc/network/interfaces.d/ifcfg-enp0s3:0

auto enp0s3:0
iface enp0s3:0 inet static
address 10.0.5.20
netmask 255.255.255.0
 
Old 08-09-2023, 08:13 PM   #22
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,857

Rep: Reputation: 161Reputation: 161
Change enp0s3:0 to enp0s3:10
 
Old 08-20-2023, 01:22 AM   #23
Jason.nix
Member
 
Registered: Feb 2023
Posts: 568

Original Poster
Rep: Reputation: 10
Quote:
Originally Posted by nini09 View Post
Change enp0s3:0 to enp0s3:10
Hello,
Thank you so much for your reply.
I did it, got the same result.
 
Old 08-21-2023, 07:39 PM   #24
nini09
Senior Member
 
Registered: Apr 2009
Posts: 1,857

Rep: Reputation: 161Reputation: 161
What is output of command, 'ifconfig' and 'route'?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Is it possible to create a virtual/clone interface to map to another existing interface ? Mac83 Linux - Networking 17 07-22-2019 03:14 PM
[CLOSE, DUPLICATE] Is it possible to create a virtual/clone interface to map to another existing interface ? Mac83 Linux - Networking 3 06-19-2019 12:26 AM
Outgoing local trafic over virtual interface has not virtual ip address :-( tkmbe Linux - Networking 3 08-25-2009 08:03 PM
Adding virtual interface for IP based virtual host pridefc Linux - General 6 03-16-2008 03:52 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 04:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration