date int64 1,220B 1,719B | question_description stringlengths 28 29.9k | accepted_answer stringlengths 12 26.4k | question_title stringlengths 14 159 |
|---|---|---|---|
1,693,183,335,000 |
I have an offline system (a robot running Ubuntu, not connected to any network) I want to monitor the resource usage over time (mainly CPU and memory). I am used to Influx and Prometheus and i was wondering if there was a tool to save the monitoring data and store until I connect to the machine and export the data, an... |
In the end I've given up using Prometheus, which without a tool like Promqueen isn't made to receive out-of-date data.
I set up Telegraf on the robot and made it output the data in Influx line protocol, so I just have to retrieve the metrics file and import it into a Influx database.
| How to monitor an offline linux and export the data from time to time |
1,693,183,335,000 |
After running (1)sudo airmon-ng check list and (2)airmon-ng start <Iface>. I cannot come back to the original managed mode of the wifi interface. I am currently using: Kali 2022.3.
(1). Kill any process/service that is currently using any wireless interface.
(2). Start the 'monitor' mode in the Iface interface.
|
Just restarting the network service, solved the problem.
run: sudo systemctl restart NetworkManager
| How to connect to wifi after toggling the wifi card into monitor mode |
1,693,183,335,000 |
for quite some time I'm working at home now. Recently I questioned if my current internet connection is good enough for my activity on my laptop. For some activities I notice a high internet usage, but I want clear facts and not just a gut feeling.
So I wondered, if I can automatically monitor how many seconds/minutes... |
Inspired by answers to this question :
you can read the amount of sent / received bytes from /sys/class/net/<interface>/statistics/tx_bytes and /sys/class/net/<interface>/statistics/rx_bytes
retrieve values every n minutes and record them in a CSV file
you may import data in your favorite spreadsheet program and comp... | Monitor how long per day or hour I'm close to my maximuim internet bandwith? So if it makes sense to buy an upgrade |
1,693,183,335,000 |
I'm trying to capture write to stdout (or stderr), but apparently the actual data is related to the exit event. I wrote a simple C program that writes to stdout and stderr.
#include <stdio.h>
int
main()
{
printf("Standard output\n");
fprintf(stderr, "Standard error\n");
return 0;
}
I compile it with
'gcc ... |
Apparently there was some problem with the version that came with Ubuntu. I downloaded the latest version (0.27.1) from sysdig website, and now the result is correct:
65099 19:55:54.695520567 7 example (10805) > write fd=1(<f>/dev/pts/0) size=16
65102 19:55:54.695526434 7 example (10805) < write res=16 data=
0x00... | Sysdig does not show exit event for write syscall |
1,693,183,335,000 |
While installing Kali Linux there was an option to choose a primary network between Ethernet and Wireless network. But since my device has a problem with wireless I opted for Ethernet. Now, I have bought a new wifi adapter from TP-link, I still cannot access it to use the internet. It shows up when I plug but there is... |
Make sure the wifi adapter is correctly installed
Then use this command:
sudo nmtui
to activate a wifi connection and set the DHCP or static IP
Note:
In Linux for all distributions, there is no primary or secondary ethernet.
But you can use the default route (to 0.0.0.0) to ethernet or wifi connection.it is simply a... | How do I enable the Wi-Fi as a primary network tool in Kali Linux? |
1,693,183,335,000 |
Comcast is enforcing a new data cap on some customers reportedly starting as early as next month, January 2021. I'm both a data scientist and a tenant under someone else's internet plan; I know I've gone over 1 TB in a month before, so I'm trying to figure out how to monitor my data usage.
Previous similar questions o... |
You are really only concerned with traffic that goes outside of your local network. Most OS-level network statistics are going to be at the interface level, not the destination/source level, and would only reflect that of a single device.
I'd suggest putting a firewall between your personal segment and that of the sh... | Recording monthly network usage for a metered connection? |
1,516,598,047,000 |
How to write a shell script to filter out the %Mem consumption of some process like Mozilla Firefox and LibreOffice Writer. Both values need to sum up.
|
Use below command to find the same
ps axo %mem,command | egrep "Firefox | Writer" | awk 'BEGIN {sum=0} {sum =sum +$1}END {print sum}'
| Memory resouce monitoring program |
1,516,598,047,000 |
I am building a communication network using Ethernet between a mobile platform and a base/controller station. So packets shall be sent from the mobile platform to the base station only. So, I need to check the connectivity between these two points maybe by using Port-mirroring or Ping-echoing. I have been looking for ... |
So basically you have answered your own question:
If you have to ensure that there's always some traffic, either base station and mobile client need to regularly ping each other, or a third party that's also connected to the network via a switch needs to ping them regularly.
If the connectivity check is done inside t... | What are the differences between Port-mirroring and Ping-echoing? |
1,516,598,047,000 |
Hello I have a set of raspberry pi installed on a client location. The RPis has internet access but not public ip. I was looking for an opensource solution to monitoring the devices some kind of software that can be instaled to send information to a cloud server about system health, uptime and such things.
Its not po... |
Icinga2 is also able to handle this configuration. Sattelite Icinga2 system can execute tests on the sattelite host (Raspberry) and send test results to the central monitoring host. It is also able to pull its configuration from the central monitoring host.
Although I like Icinga very much, I still feel that learning ... | remote server monitoring without public ip |
1,516,598,047,000 |
Condition: controlling 3D Image output of test code by mouse cause all CPUs to 100%; differential solutions do not help; no clicking of mouse on image
Motivation: to understand why mouse activates 3D Image process even when no evaluation of the notebook in Debian Mathematica
Fig. 1 My Desktop where trying to overl... |
This was a bug in Mathematica 11.0.0 in Debian.
Their testing was mostly in Mint Linux, where they did not obverse the problems.
I posted a report about the case to Mathematica, where they promptly reacted and fixed the case.
The new release Mathematica 11.0.1 is significantly better in Debian 8.5.
| Why Mouse Activates 3D Image in non-evaluated NB of Debian Mathematica? |
1,516,598,047,000 |
I tried many ways to launch an application i7z_GUI on Debian, but it just won't start.
I tried it both as root as shown below and as a user:
su-to-root -X -c /usr/sbin/i7z_GUI
gksu -u root /usr/sbin/i7z_GUI
./usr/sbin/i7z_GUI
After properly setting up sudo, it wouldn't work either:
Segmentation fault
it says.
|
Solved by compiling the application from its source code.
| How to launch i7z_GUI (segmentation fault)? |
1,516,598,047,000 |
As I am unable to install psutil to work on raspberry pi on python3, I am looking for any alternative (or a proper way to install it).
What I want is to be able to see what's the status of the computer in terms of CPU and RAM available, so that if that's the case I can "sleep" the script until the computer relaxes, in... |
While it appears there's no alternative, I will follow this strategy
http://www.raspberrypi.org/forums/viewtopic.php?f=32&t=
| Alternative for psutil for ARM processors (raspberry pi) and python3 |
1,516,598,047,000 |
I've had 'accton' (in package psacct-6.3.2-63.el6_3.3.x86_64) turned on as I want to be able to report on a particular process (so I've written a script that will take the psacct file and get the information I want).
What I've not been able to determine is how forked process time is handled in relation to the parent a... |
All the times are per-process (in older versions of Linux, they were per-thread). Metering starts when a process is forked, continues over all of its execs, and ends when it exits. Times from its children are not included; they are available in the respective records for each child when the child exits. If you're usin... | CPU time that accton (psacct) records - recorded time relationship between parent and children processes |
1,516,598,047,000 |
My Linux version is Linux 3.4.76-65.111.amzn1.x86_64 x86_64. It's AWS.
These days I'm suffering from the absence of monitoring tools, processes sometimes die without knowing it.
My need is simple.
Though they might be achieved by my own shell script, I want it managed by tools.
Alert if specific processes die
Alert ... |
I'd use Nagios. In a survey I did awhile back I noticed that this was a big majority favorite. Notice that a lot of sites use multiple monitoring tools.
I'd like to remind you that "free" only means that the source code is available, effort (in any case) is still required and that is NOT free.
BTW, Nagios comes in a... | Recommendations for Free Linux monitoring tools [closed] |
1,516,598,047,000 |
There are tools available like MRTG , Cacti etc through which we can monitor network traffic on network interfaces on a host. The network traffic flow information that is provided by these tools is the total traffic that is flowing through the interface . But I want to drill down further like bandwidth classification... |
I would recommend ntop for this. Mike briefly mentions it in his answer, but it seems more of a side note. I personally think ntop is the best candidate.
Ntop is similar to tools like MRTG & Cacti in that it's a long running background process that gathers information and lets you browse through it via a web browser.
... | Bandwidth Management tool |
1,516,598,047,000 |
Monitoring the folder and when the .CPP file arrived inside the folder then automatically compile the program in ubuntu
can anyone help me to solve this problem please?
|
For such a simple case real monitoring (inotify) is probably overkill.
#! /bin/bash
file_path='/path/to/file.cpp'
while true; do
if [ -f "$file_path" ]; then
: do something
exit 0
else
sleep 1
fi
done
| Monitoring folder and compile [closed] |
1,516,598,047,000 |
Is there a program to monitor all ressource utilzation at once for a personal computer : CPU, memory, hard drives ?
|
Take a look to Conky. Also searching for CPU widgets for ArchLinux will give you a lot of results for what you want.
Additionally, if you want to know all that information via CLI, you can have it quickly with:
echo CPU: && mpstat && echo && echo MEMORY: && free && echo && echo "DISK USAGE:" && df -h
| Monitor all ressources use? [closed] |
1,516,598,047,000 |
I have a Sensu SERVER setup and a Sensu CLIENT.
Services sensu-server, sensu-client, uchiwa, sensu-api are running on SERVER.
Services sensu-client is running on CLIENT.
All the checks I described in /etc/sensu/conf.d in SERVER are listed in uchiwa.
Unfortunately, I can't see any client listed. Including the sensu-cl... |
I solved this issue. RabbitMQ credentials in /etc/sensu/conf.d/rabbitmq.json were not correct. I created a new user by going to SERVER:4567 (RabbitMQ GUI) and added those credentials in the json file.
| Unable to see client on Uchiwa dashboard (Sensu Monitoring) |
1,516,598,047,000 |
I have an Ubuntu 16.04 xenial Nginx server environment with postfix and a few webapps under /var/www/html.
How could I notify myself by my an email sent to my personal Gmail account, if my site is down?
The desired state is that if the webpages or at least in homepage, doesn't give https status 200 (OK), I'll get dai... |
As mentioned in the comments, there are literally dozens of ways you can do this.
The most basic possible would be to call wget or curl from a daily cron job and check their exit code (if they can't download the page, they'll return a non-zero exit code), then use that to trigger an e-mail. While this approach has a ... | Notifying myself thtat my webapp/website is down (Nginx environment) [closed] |
1,377,294,573,000 |
Linux as router: I have 3 Internet providers, each with its own modem.
Provider1, which is gateway address 192.168.1.1
Connected to linux router eth1/192.168.1.2
Provider2, gateway address 192.168.2.1
Connected to linux router eth2/192.168.2.2
Provider3, gateway address 192.168.3.1
Connected to linux router eth3/192.1... |
Here is a similar setup from one of our routers (with some irrelevant stuff snipped). Note that this handles incoming connections as well.
Note the use of variables instead of hard-coded mark numbers. So much easier to maintain! They're stored in a separate script, and sourced in. Table names are configured in /etc/ip... | Linux as router with multiple internet providers |
1,377,294,573,000 |
I use the auto generated rules that come from OpenWRT as an example of NAT reflection (NAT loopback).
So let's pretend there's a network 192.168.1.0/24 with two hosts (+ router): 192.168.1.100 and 192.168.1.200. The router has two interfaces LAN (br-lan) and WAN (eth0). The LAN interface has an IP 192.168.1.1 and the ... |
For a NAT to work properly both the packets from client to server and the packets from server to client must pass through the NAT.
Note that the NAT table in iptables is only used for the first packet of a connection. Later packets related to the connection are processed using the internal mapping tables established ... | How does NAT reflection (NAT loopback) work? |
1,377,294,573,000 |
I'd like to redirect local requests to port which is translated with NAT. I have following rules:
iptables -t nat -A PREROUTING -p tcp --dport 9020 -j DNAT --to 10.0.3.11:80
however request coming from localhost are rejected:
wget http://127.0.0.1:9020
Connecting to 127.0.0.1:9020... failed: Connection refused.
When... |
Based on @Hauke Laging comments I put together this:
# connections from outside
iptables -t nat -A PREROUTING -p tcp --dport 9020 -j DNAT --to 10.0.3.11:80
# for local connection
iptables -t nat -A OUTPUT -p tcp --dport 9020 -j DNAT --to 10.0.3.11:80
# Masquerade local subnet
iptables -t nat -A POSTROUTING -s 10.0.3.... | iptables: redirect local request with NAT |
1,377,294,573,000 |
I made two experiments. This is the network for both of them:
[private network] [public network]
A -------------------- R ----------------- B
192.168.0.5 192.168.0.1|192.0.2.1 192.0.2.8
A's default gateway is R. R has IPv4 forwarding active and the following iptables rule:
iptables -t nat -A... |
would it hurt the kernel to "borrow" the port from the TCP port pool when it becomes actively masqueraded?
I guess the answer is "no, but it doesn't matter much."
I incorrectly assumed R only used the destination transport address of the response packet to tell whether it was headed towards A or itself. It actually ... | Why doesn't NAT reserve ports from the machine's TCP and UDP port pool? |
1,377,294,573,000 |
I'm trying to figure out how NAT and iptables work. While I'm in the trial-and-error phase of learning about it, I found two somewhat conflicting howtos.
One howto uses a script to call iptables rules one after another. The script seems to be named and stored such that it is executed early during system boot, and I th... |
I've used both techniques in the past. These days, I'm gravitating towards a hybrid of the two.
If your ruleset has five or six simple rules, either method is fine. Things start to become interesting when you have big rulesets: large installations, your firewalling box does a bit of routing, etc.
Just remember, you ca... | iptables: The "script" way or the "*filter, rules, COMMIT" way? |
1,377,294,573,000 |
In GlusterFS, lets say i have 2 Nodes (Servers) on a Volume. Lets say the volume info is something like this:
Volume Name: volume-www
Brick1: gluster-server-01:/volume-www/brick
Brick2: gluster-server-02:/volume-www/brick
From the Client, as we know, we have to mount the volume volume-www by mounting from one Server... |
When you are doing this:
mount -t glusterfs gluster-server-01:/volume-www /var/www
You are initially connecting to one of the nodes that make up the Gluster volume, but the Gluster Native Client (which is FUSE-based) receives information about the other nodes from gluster-server-01. Since the client now knows abou... | GlusterFS how to failover (smartly) if a mounted Server is failed? |
1,377,294,573,000 |
So, not concerning ourselves with the WHY, and more so with the HOW, I'd like to see if anyone knows where I'm going wrong here.
Basically, I'd like to forward all packets headed for port 80 on an IP that I've aliased to the loopback device (169.254.169.254) to be forwarded to port 8080 on another IP, which happens to... |
I actually got this working by ensuring the kernel module "br_netfilter" was loaded on the host machine. It was as simple as that, annoyingly simple after being stumped for so long.
Documentation/articles that lead me to the solution:
1)
https://github.com/omribahumi/libvirt_metadata_api and https://thewiringcloset.w... | Unable to get NAT working via iptables PREROUTING chain |
1,377,294,573,000 |
I have an OpenWRT gateway (self-built 19.07, kernel 4.14.156) that sits on a public IP address in front of my private network. I am using nftables (not iptables).
I would like to expose a non-standard port on the public address, and forward it to a standard port on a machine behind the gateway. I think this used to ... |
You are not translating the port number. When the external connection is to port 1234, this is not a problem. But when it is to 4321, the dnat passes through to port 4321 on the internal server, not port 1234. Try
tcp dport { 1234, 4321 } log prefix "nat-pre " dnat 172.23.32.200:1234;
You do not need to translate ... | Port forwarding & NAT with nftables |
1,377,294,573,000 |
We have say 4 users in a private network connected to the Internet trough a Linux router with a public IP address that is doing network address translation (NAT). I have to configure QoS to give access to the users to Internet but with throttled bandwidth for 2 users while for others no limitations.
eth0:121.51.26.35
... |
You need to pick a class aware qdisc like HFSC or HTB.
Then you'll have to build a class tree like this:
Root Class (10MBit)
|
\--- XyZ Class (rate 3Mbit ceil 3Mbit)
| |
| \--- Client 10 (rate 1.5Mbit ceil 3Mbit)
| \--- Client 11 (rate 1.5Mbit ceil 3Mbit)
|
\--- Client 30 (rate 3.5Mbit ceil 10Mbit)
\--- Clien... | How to configure QoS per IP basis? |
1,377,294,573,000 |
In my host I have:
networking.nat.enable = true;
networking.nat.internalInterfaces = ["ve-+"];
networking.nat.externalInterface = "wlp2s0f0u8";
In my container I have defined:
containers.nixbincache = {
privateNetwork = true;
hostAddress = "192.168.140.10";
localAddress = "192.168.140.11";
.... |
It worked by running iptables -t nat -A POSTROUTING -o wlp2s0f0u7 -j MASQUERADE.
Here is the output iptable rules:
sudo iptables -L -v -t nat
Chain PREROUTING (policy ACCEPT 154 packets, 22783 bytes)
pkts bytes target prot opt in out source destination
203 29566 nixos-nat-pre all... | How to enable internet access for nixos container with private network |
1,377,294,573,000 |
I have a physical network with a Linux server (Ubuntu 16.04, kernel 4.13) and several gadgets on it. Each gadget has the same unchangeable static IP, e.g. 192.168.0.222/24. I would like to communicate with all these gadgets via an arbitrary IP protocol (e.g. ICMP ping or a custom UDP protocol)
Fortunately I have a ma... |
I was able to achieve this with the following nftables ruleset (I had to build nft from source as v0.5 which ships with Ubuntu 16.04 doesn't support packet field mangling) :
table ip mytable {
chain prerouting {
type filter hook prerouting priority -300; policy accept;
iifname "... | nftables / iptables rules to rewrite source IP by interface |
1,377,294,573,000 |
The situation involves 3 machines:
A Some laptop connected somewhere to the Internet via any mean
B A server connected to the Internet through a standard ISP (static IP provided by dyndns: myserver.dyndns.com)
C Another server connected
to the internet via a 4G Dongle
A <--- ISP1 --- ISP 2 ---> B <--- ISP 2 --- 4G ... |
Please, could you provide iptables -t filter -nvL outputs on servers B and C?
I guess the autossh channel runs on server C. Is it right? If so, I suggest a different approach. On B, you need a REDIRECT rule, because the kernel will not allow an unprivileged user to open the port 80.
iptables -t nat -A PREROUTING -p tc... | IP forwarding through ssh tunnel |
1,377,294,573,000 |
I need to find a way to copy files from mymachine to a server priv-server sitting on a private NATted network via a server pub-server with a public IP. The behind-NAT machine priv-server only has certs for user@mymachine, so the certs need to be forwarded from mymachine via pub-server to priv-server
So in order to lo... |
Instead use a more low level form of copying files by catting them locally, and piping that into a remote cat > filename command on priv-server:
$ cat file1.txt | ssh -A user@pub-server 'ssh user@priv-server "cat > file1.txt"'
or with compression:
$ gzip -c file1.txt | ssh -A user@pub-server 'ssh user@priv-server "gu... | Copying a file using SSH over a tunnel with cert forwarding |
1,377,294,573,000 |
Given: I have a machine (HostA) with only one NIC which has Internet connectivity. I have another machine (HostB) with one NIC on the same switch. HostB is not configured for Internet access yet. HostA has its default gateway and DNS servers appropriately configured. IPv4 is being used. OSes on the hosts are Ubuntu 13... |
Routing is about "where (and if) to send to". That's not limited to selecting a NIC. In your case routing is very simple though.
You need masquerading in its most simple form (all commands on host A):
iptables -t nat -I POSTROUTING -s 192.168.22.234 -j MASQUERADE
And maybe (if not yet) you need allow forwarding:
ipta... | Can iptables be used to convert a single-homed host into a NAT server? |
1,377,294,573,000 |
I have a simple Linux router with multiple NICs and IPv4 forwarding enabled.
The router has two static WAN IP addresses, assigned to one interface (eth0, eth0:0). (In the following text, I will obfuscate the actual public IP addresses (257 as an octet).)
The router can be pinged on both external WAN IP addresses from ... |
Use SNAT instead of MASQUERADE
... in order to choose something else than the default.
Instead of using MASQUERADE for the generic case (all other LANs), add a SNAT exception for LAN3 clients. This must match before the other nat/POSTROUTING rule in order to override it so -I is used below instead of -A to apply at th... | NAT router with 2 external WAN IPs A+B and multiple internal LANs: Let 1 LAN use external IP address B, all other A |
1,377,294,573,000 |
I has a JioFi Wifi Router which is Double NAT ISP. So, I have a WAN ip
and external public ip.
Whenever I do port forwarding the specific port, only it affects WAN ip.So As a Result I can't access my web server...
|
Your ISP does NAT between its public IP (157.50.xx.xx) and the ISP internal private IP (10.89.xx.xx). Unless you can convince your ISP (by switching to the appropriate plan, usually for business, that gives you a personal public IP and paying more money, or whatever) to port forward the ports you need, there's nothing... | How To Configure a noip on linux, if I has Double NAT ISP Like JioFi? |
1,377,294,573,000 |
Similar questions have been asked before but my setup is a little different and the solutions to those questions are not working. A have a CentOS 6 server running iptables with 5 interfaces:
eth0: Management 136.2.188.0/24
eth1: Cluster1 internal 10.1.0.0/16
eth2: Cluster1 external 136.2.217.96/27
eth3: Cluster2 int... |
OK, I figured it out. What I had to do was add the internal subnet route to each route table then set rules to control what interface traffic routes to/from. Then in iptables marking packets with the mangle table was not needed, just the typical forward and nat rules.
ip route add 136.2.178.32/28 dev eth4 table 1
ip... | NAT box with multiple internal and external interfaces |
1,377,294,573,000 |
My home network currently looks like this:
I'd like to restructure it to look like this (get rid of the ISP switch and plug the STBs into mine):
My gateway is a PC with two Ethernet ports (doing NAT and providing DHCP and DNS to my LAN) and is running GNU/Linux.
The obstacle is the ISP's STBs (set-top boxes, like ca... |
To answer the question as stated, I got some advice from a friend network guru to bridge the LAN and WAN interfaces, then use ebtables to filter out what is to get bridged:
lan0: [add LAN IPs and use as LAN interface]
eth0 (LAN)
eth1 (WAN) [add WAN IPs and use as WAN interface]
# Forward traffic to/from STBs
... | Exempt some devices from NAT |
1,377,294,573,000 |
There is only one table on the server - "nat" and it contains only two chains: "prerouting" and "postrouting". IP forwarding is enabled. I'm trying to set more specific conditions for the source nat rule. When I set the classic rule :
nft add rule nat postrouting ip saddr 192.168.1.0/24 oif eth0 snat 1.2.3.4
everythi... |
This feature also requires kernel >= 5.5 for adequate netfilter support. Description in kernelnewbies.org:
Linux 5.5 was released on 26 Jan 2020
[...]
netfilter
Support iif matches in POSTROUTING commit
From the commit:
netfilter: Support iif matches in POSTROUTING
Instead of generally
passing NULL to NF_HOOK_... | How to set hard conditions for source nat rules in nftables? |
1,377,294,573,000 |
Basically trying to bend bridging and NATing to my will with quite a unique project.
I've simplified what I'm doing below (VM=Kali virtual machine for testing):
ZoneX's are network namespaces, vexxx's are virtual links created with ip link
The premise is to create a gateway for the LAN which can divert traffic (based... |
The solution is to mark new connections and use the mark for policy routing:
iptables -t mangle -A FORWARD -i ve006 -m connmark -j CONNMARK --set-mark 6
iptables -t mangle -A FORWARD -i ve010 -m connmark -j CONNMARK --set-mark 10
ip rule has a test for fwmark. Thus you create a routing table for ve006 and one for ve... | How to create an internal multipath gateway |
1,377,294,573,000 |
My ISP still doesn't support IPv6, and I currently use OpenVpn or OpenConnect VPN to get IPv6 connection.
Now that there is a Ubuntu server running VPN client UNDER an OpenWRT router.
Is it possible to share (only) the IPv6 connection from the server to the whole LAN network?
|
Sure, if your IPv6 connection gives you a prefix that is large enough for all the devices in the LAN (i.e. a prefix number smaller than /128, ideally /64 or less).
First, enable IPv6 forwarding by adding this line to /etc/sysctl.conf:
net.ipv6.conf.all.forwarding=1
Then either run sudo sysctl -p or reboot to make it ... | How to share an IPv6 connection to the whole LAN? |
1,377,294,573,000 |
Machine 62: Ubuntu 16.04, has access to internet, can be accessed via the internet.
On the 62 machine, there is VirtualBox with a VM (also Ubuntu).
I'd like the VM to behave like a 'normal' machine (ip-requests). I reserved a static IP for it, but now I'm not sure how to configure the interfaces of the host and the gu... |
You've to create a bridged network between the Host and VM. The configuration varies on Hypervisor vendor.
In case you're using Oracle Virtual Box
Open Oracle VM VirtualBox Manager, select the VM and go to network section.
In Adopter 1 tab change the default NAT to Bridged Adopter and chose host's Network Adopter fro... | Access VM via static IP (NAT?) |
1,598,462,922,000 |
I need to script some Iptables rule changes involving NAT rules (-t nat) on Ubuntu 16 servers.
It seems like the common way to drop a rule using -D [rule here] does not work with the -t identifier... I really do not want to complicate the scripting by having to identify which rule in my chain I'm looking for and get i... |
Given any rule with -I (insert) or -A (append), you can repeat the rule definition with -D to delete it.
For your particular example, this will delete the first matching rule in the OUTPUT chain for the nat table
iptables -t nat -D OUTPUT -p tcp -o lo --dport 3306 -j DNAT --to-destination RMT_IP:3306
| iptables - Drop NAT rules based on rule/name, NOT rule number |
1,598,462,922,000 |
I observed that MASQUERADE target does not match on packets in the reply direction (in terms of netfilter conntrack).
I've a single simple -t nat -A POSTROUTING -s 10.a.0.0/16 -d 10.b.0.0/16 -j MASQUERADE rule, nothing else besides of ACCEPT policies on all chains, and it seems that
case 1) SYN packets of connection i... |
The identity of a TCP connection is defined by a set of four things:
the IP address of endpoint A
the IP address of endpoint B
the port number of endpoint A
the port number of endpoint B
The TCP protocol standard says that if any of these four things are changed, the packet must not be considered part of the same co... | in iptables, does MASQUERADE match only on NEW connections (SYN packets)? |
1,598,462,922,000 |
I have an embedded Linux device tethered to my PC via Ethernet. The PC is able to access a tftp server via VPN, and I am trying to set up iptables rules to allow the embedded device to access the tftp server.
First of all, I used Network Manager to bring up a connection on the eno1 device, and configured the embedded ... |
Since Linux 4.7 in 2016, the conntrack automatic helper assignment was disabled by default (after having years of warning about this in kernel messages):
Four years ago we introduced a new sysctl knob to disable automatic
helper assignment in 72110dfaa907 ("netfilter: nf_ct_helper: disable
automatic helper assign... | iptables rules to forward tftp via NAT |
1,598,462,922,000 |
Under an Ubuntu 18.04 host, I have set-up an Ubuntu 10.04 guest VM from a cloned HD. The VM fires up fine, I can ssh into it from the host, but it fails to communicate outside of the host.
My question is what is wrong with my configuration below:
Guest VM:
Started with qemu-system-x86_64 G.qcow2 -m 4096 -smp 4 -no-acp... |
The MASQUERADE rule happens at POSTROUTING: that is after a routing decision was already made and a destination interface was already chosen. To communicate with outside, the host will use 192.168.117.1 via eno1. So the MASQUERADE rule criteria should be when using the output interface eno1 rather than br0vm.
You shou... | nat configuration for qemu-kvm guest and host networks |
1,598,462,922,000 |
I'm experimenting DNS server setup that reply different results based on source IP address. and the same time I need to dynamically change what interface external source ip should forward,
eth0 physical inteface 192.168.1.10
eth0: virtual interface 1 192.168.1.11
eth0:1 virtual interface 2 192.168.1.12
I... |
Have a look at iproute2.
You can easily configure many route-tables and define network interface that handles the connection, including solution of your problem.
Here you are some useful examples:
http://linux-ip.net/html/routing-tables.html
http://lartc.org/howto/lartc.rpdb.html
References:
http://man7.org/linux/m... | Forward traffic to virtual interface based on source IP address dynamically using iptables |
1,598,462,922,000 |
I have 2 CentOS 7 guests running in VirtualBox on a Ubuntu host.
I want to be able to:
Connect using ssh from host to guest
Download/install packages from the Internet on the guest.
I currently have following two virtual network interfaces
Host Only, mapped as 'enp0s3' on guest
NAT, mapped as 'enp0s8' on guest
My ... |
So I finally got it to work
I was missing netmask value in the configuration
Host only NIC enp0s3
TYPE=Ethernet
BOOTPROTO=static
NAME=enp0s3
UUID=71d4200e-199d-4d03-935d-6d2e88c41956
DEVICE=enp0s3
ONBOOT=yes
IPADDR=192.168.56.101
NETMASK=255.255.255.0
NAT NIC enp0s8
HWADDR=08:00:27:49:5A:6C
TYPE=Ethernet
BOOTPROTO=dh... | Enable ssh host to guest & guest Internet on CentOS 7 guest with VirtualBox |
1,598,462,922,000 |
According to tcpdump, the initial packet from the VPN client gets its source address translated and sent to the destination and the response packet arrives, but this response packet is just lost. I even did firewall-cmd --set-log-denied=all, but this very packet was lost without any log message.
Previously I had my Op... |
So I decided to reboot, but before reboot I dumped the runtime kernel parameters to a file and afterwards repeated the iptables/sysctl setup and this time it worked!
After comparing sysctl output I see that net.ipv4.conf.eth0.forwarding was 0 even though net.ipv4.ip_forward was 1. I didn't know that forwarding could b... | MASQUERADE doesn't work - the response packets are lost |
1,598,462,922,000 |
We run a FreePBX server on our LAN and softphones can register using the local SIP server IP.
I need these softphones to be able to register over the internet too so we have configured the firewall and created a dns entry for sip.ourdomain.com.
When the softphones are configured to use sip.ourdomain.com then can regi... |
What you may need is defining in your infra-structure a split view DNS or multiview DNS architecture.
Thus in your internal network, your internal DNS server will resolve sip.ourdomain.com to 192.168.1.8 and externally to the current public IP address.
Another alternative is enforcing a public IP address for the SIP ... | Unable to register SIP via WiFi |
1,598,462,922,000 |
My general question is this: What's the best way (simplest, easiest, quickest, least error-prone, etc.) to verify iptables NAT rules locally on a single host (i.e. without a network connection) at the command-line?
What follows are the details of specific (failed) attempts at checking a simple DNAT rule using NetCat. ... |
Short Explanation: The dummy interfaces and virtual IP addresses send packets through the loopback interface, which isn't affected by the PREROUTING chain. By using network namespaces with veth interfaces we can send traffic from one IP address to another in a way that more accurately models multi-host network traffic... | Testing iptables DNAT Rule Locally Using NetCat |
1,598,462,922,000 |
I have a Bind9 on a host.
I have several guest virtual machines.
I want my virtual machines to use the Bind9 located on the host.
I know how to make Bind9 accept requests from my vitual machines (listen-on + allow-recursion).
I want to achieve it using iptables/netfilter, without modifing Bind9 configuration (aka li... |
You have to use sysctl -w net.ipv4.conf.XXX.route_localnet=1 as you did, but probably on the virtual Ethernet interface.
This allow the kernel to keep martin packets.
Also keep in mind that locally generated packets does not pass into the PREROUTING chain. So you have to use the OUTPUT chain.
And finally don't try t... | Common DNS for virtual machines - with iptables/netfilter |
1,598,462,922,000 |
I am trying to use DNAT on a new custom Linux target, but I get an error with the following basic command:
#iptables -t nat -A PREROUTING -d 10.110.0.250 -p tcp --dport 9090 -j DNAT --to 10.110.0.239:80
$iptables: No chain/target/match by that name.
I think all modules are correctly loaded:
# lsmod | grep ip
ipt_MAS... |
The problem was a missing module XT_TCPUDP
There is the full list of dynamic loaded module for my command :
xt_nat 1527 1 - Live 0xbf12f000
xt_tcpudp 1961 1 - Live 0xbf12b000
iptable_nat 2396 1 - Live 0xbf127000
nf_conntrack_ipv4 11354 1 - Live 0xbf120000
nf_defrag_ipv4 1331 1 nf_conntrack_ipv4, Live 0xbf11c000
nf_nat... | iptables DNAT: 'No chain/target/match by that name' |
1,598,462,922,000 |
I'd like to rewrite the source IP on TCP/514 traffic leaving a redhat machine, for connections that weren't initiated from the machine.
The machine receives TCP/514 traffic on an interface, for example 10.10.0.20, and then I'd like to return the traffic as though the reply is from 10.10.0.15 (which isn't assigned to t... |
DSR method
The most efficient way would be to configure Direct Server Return mode correctly on Netscaler, where Netscaler does MAC based forwarding to the syslog server with destination VIP address unchanged (10.10.0.15).
The syslog server also needs to have that VIP address in order to receive packets forwarded from ... | Rewrite source IP in TCP replies using iptables |
1,598,462,922,000 |
I've a Linux box with 3 network adapaters, which I'd like to configure as follow:
Adapter A is connected to computer A
Adapter B is connected to computer B
Adapter C is connected to the Internet. Specifically, to someserver.com
What I want to acheive:
All traffic from A will go to the Internet
Define a special "sec... |
For general access, you'll have to use MASQUARADE / SNAT (depending if your IP address on C is dynamic or static).
So let's say current situation is your computer A has static IP address a.a.a.a, and your computer B has static IP address b.b.b.b. Both have default gateway to computer C. And Someserver.com has static ... | Bridge/Router with custom logic |
1,598,462,922,000 |
I have a machine that serves both as a router and a server. I have several lxc containers on this machine, and want to expose them to both the LAN and WAN. Following https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/security_guide/sec-configuring_port_forwarding_using_nftables I was able to... |
Let's look at a part of the Packet flow in Netfilter and General Networking schematic. It was made for iptables but most of it applies for nftables:
It's documented that the nat table is consulted only for packets in conntrack state NEW: packets starting a new flow.
Routed/forwarded traffic arrives from the nat/prer... | nft port forwarding not working on router |
1,598,462,922,000 |
I'm running Gentoo Linux, so using plain iptbales to manage my firewall and networking.
I usually use wan0 for all my traffic, but since I have already a web-server behind that i would like wan1 (bind to another domain) for my second web-server.
I have three interfaces:
eth0 = LAN
wan0 = Primary used WAN (default gat... |
As the answer is tied to the configuration, I make some assumptions. You'll have to adapt the answer to fit the actual configuration.
wan1's LAN and gateway for wan1 arbitrarily chosen as 84.114.7.0/24 and 84.114.7.254.
no consideration of firewall rules made, but all this shouldn't interact with them.
On Linux ip... | iptables: MultiWAN and portforwarding & port redirection |
1,598,462,922,000 |
I have been facing an unusual problem with my VirtualBox NAT settings. I have scoured the Unix SE Forums but was unable to find a similar issue reported. I did find one but it was from 2009 and related to Corporate Proxy.
Details :
Windows 7 Host running VirtualBox 5.1.0
Multiple Guest OS - Ubuntu, Fedora, CentOS (Al... |
I was finally able to resolve this issue. Actually, its just a temporary fix as of now till I figure out more.
It looks like VBox settings and VM settings are fine, it is my Windows Host network configuration causing the issue.
I checked further and found that even though I was getting ICMP and DNS resolution, my TCP ... | VirtualBox NAT Issue - Able to Ping and Lookup. Unable to Browse |
1,598,462,922,000 |
Im using a private IP address and I want to keep alive SNAT entries in my Router (Gateway) for at least two hours (some windows apps of my network are using TCP keepalive set to 2 hours). Gateway is a Linux machine so i set nf_conntrack_tcp_timeout_established and nf_conntrack_generic_timeout values to 7400 seconds:
e... |
The root cause was that the conntrack code in the kernel has been modified. As we are using a embedded linux distribution modified by our provider, the function that refresh the timeout for the SNAT entry was pointing to a special function used for provide one of the our provider new 'features'. I have fixed it and no... | Conntrack TCP Timeout for state stablished not working |
1,626,675,809,000 |
I have Debian 4.19.194-1 as a router server with LAN, WAN, PPPOE (as gateway) and COMPUTER1 in LAN network which should have access to internet through Debian router.
As firewall I use nftables with rules:
#!/usr/sbin/nft -f
flush ruleset
define EXTIF = "ppp0"
define LANIF = "enp1s0"
define WANIF = "enp4s0"
define LO... |
The firewall rules did not cause the problem. Instead, it's due to the MTU difference in "plain" Ethernet and PPPoE. Since PPP header takes up (at least) 8 bytes, and the usual MTU of Ethernet itself is 1500 bytes, the MTU of PPPoE in that case will be at most 1492 bytes.
I don't know MTU stuff well enough to tell the... | Router with nftables doesn't work well |
1,626,675,809,000 |
I have a frustrating issue with virtualbox where I am unable to ssh into the virtual machine.
I am using debian on both the host as well as the guest.
ip addr on host
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:26:b6:f5:f3:26 brd ff:ff:ff:ff:... |
Please check these;
1. VM has a bridged network? then check subnet mask.
Two host have different networks and gateway.
2. VM has a NAT? then you have to configure Port forwarding rule.
Refer this link:
| Networking issue with Virtualbox |
1,626,675,809,000 |
I have sshd running on port 8000 running on a freshly installed plain vanilla Linux Mint 17.2 Rafaela.
$ sudo netstat -tnlp | grep :8000
tcp 0 0 0.0.0.0:8000 0.0.0.0:* LISTEN 839/sshd
tcp6 0 0 :::8000 :::* LISTEN 839/s... |
You won't be able to connect to the NAT'ed server name from the host which is the destination of the NAT. The reason is very simple NAT breaks TCP/IP in this case. Just walk through what's happening at the TCP level and you will understand why it's not supposed to work:
from 192.168.10.10 you send a SYN packet to m... | ssh connection refused from same PC when going outside local network |
1,626,675,809,000 |
I am using older SOHO router wl500gP (it is v1 but I think this is not important) with custom Oleg firmware. My topology looks like this:
192.168.3.3 192.168.3.2 NAT 192.168.2.1 192.168.2.170 (DHCP)
PC1<--------------------------->(WAN)wl500gP(LAN)<-------------------------------->PC2
A... |
That's normal, and has nothing to do with NAT. Linux, by default, treats IP addresses as belonging to the machine¹, not to a particular interface. So it'll answer packets to 192.168.2.1 on any interface, not just the LAN interface.
That said, NAT does not imply a firewall, or vice versa. You can, for example, map inte... | Does NAT allow accessing internal network (or router's local interface) from outisde by default? |
1,626,675,809,000 |
I want to configure a NAT behavior different from the default one implemented by iptables.
In this example:
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 193.49.142.107:2000-400
The default behavior of NAT implemented by iptables is Endpoint independent.
This means, all sessions initiated from the same h... |
SNAT accepts a --random option (from iptables-extensions manpage):
--random
If option --random is used then port mapping will be randomized
(kernel >= 2.6.21).
So I'd try something like:
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 193.49.142.107:2000-4000 --random
| Randomize external port when doing NAT with iptables |
1,626,675,809,000 |
Since I'm using a transparent proxy service, I use a raspberry pi as my home router. Its OS is plain Raspbian. Now I'm setting up a Minecraft server on 192.168.2.28, and am exposing it to WAN using NAT. Here's my /etc/nftables.conf:
#!/sbin/nft -f
flush ruleset
table ip filter {
chain output {
type filte... |
As a reminder, nftables (just like iptables) sees only the first packet of a flow to be NAT-ed. When it comes to doing NAT, every other packet in the same flow will be handled directly by Netfilter/conntrack without seeing nftables anymore: so the return traffic is automatically un-NAT-ed without further assistance.
T... | How to configure port forwarding with nftables for a Minecraft server on Raspberry Pi? |
1,626,675,809,000 |
I am currently setting up my iot router and ran into some issues regarding connection speed. The router itself is a cascading router. My Internet speed is 100Mbit which I verified by directly connecting to the main router via speed test. However, if I connect it via my cascading router, I only get a connection speed o... |
The Banana R1/Lamobo R1 while an interesting piece of hardware has too many shortcomings.
Firstly, the "switch" internal interface bandwidth is shared. A theoretical 1GBps tops for all shared 5 ports; the official speed people been able to get from it per interface is around 300Mbit.
Second, it has to be setup for th... | Iptables NAT / Kernel IP forwarding limited to ~10Mbit |
1,626,675,809,000 |
How would I go about using ssh on Mac OS X to remote into a computer that's overseas? I would like to help my brother with his computer, but he lives in the UK now (and I'm pretty sure he uses a VPN to maintain connection to US based streaming media services). I've done it on my LAN, but never to a remote server...mu... |
Well you would need him to port forward port 22 from his computer and have him be running sshd if you want to do it the simple way.
On the other hand, you can do the dirty work and have him do a port forward through ssh to your computer. This would be done by you setting up an ssh daemon (instructions for OSX here), t... | Trying to SSH overseas [closed] |
1,626,675,809,000 |
I have a centos 6.5 installed on Virtual Box. I'm trying to configure a basic ftp server. Below are details of it.
Installed vsftpd from DVD/Yum: Status -> Successful
Disabled firewall for test purposes,
chkconfig iptables off : successful
service iptables stop : successful
Also set selinux in disabled mode: succes... |
An FTP server behind a port forwarder can’t serve in the passive mode unless the software used has a special design to pass FTP data connections through. Cases are:
The NAT software able to sniff for 227 Entering Passive Mode in FTP control connection, to do port forwarding accordingly and some mangling of FTP contro... | FTP Troubleshooting |
1,626,675,809,000 |
I'm trying to run docker inside of Ubuntu 22.04.3 LTS running in WSL-2 on my Windows 10 machine.
I have followed the instructions here. But it's still not working, I am getting the following error when I run sudo dockerd :
failed to register "bridge" driver: failed to create NAT chain DOCKER:
iptables failed: i... |
I followed this post, which says to launch ubuntu.exe as administrator and that will fix the issue.
What this does is reinstall a distro, and iptables worked there. Still didn't work on the first distro I installed previously. But it works fine on this newly installed distro so I considered it fixed.
| Launching docker daemon in Ubuntu 22.04 LTS on WSL-2 fails because of iptables |
1,626,675,809,000 |
I am trying to debug an application which sends RPCs via HTTPS. In order to read the actual RPC content, I am trying to use SSLSplit on the same machine as the application to MITM the connection. To that end, I set up a rule in my iptables NAT table which routes all traffic not coming from a root application through 1... |
Reading OP's very same linked comment:
Add an input interface so that only inbound connections are sent to
sslsplit, e.g. if your LAN facing interface is eth0 and your WAN
facing interface is eth1,
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 443 -j REDIRECT --to-port 8080
which isn't what was done and thus... | Local transparent proxy SSLSplit causes forwarding loop |
1,626,675,809,000 |
I'm trying to ping an external ip (in this case google) from inside a network namespace.
ip netns add ns1
# Create v-eth1 and v-peer1: v-eth1 is in the host space whereas peer-1 is supposed to be in the ns
ip link add v-eth1 type veth peer name v-peer1
# Move v-peer1 to ns
ip link set v-peer1 netns ns1
# set v-e... |
You have Docker which itself alters the firewall rules. I can't tell if that's because of Docker, but you have iptables' default policy for filter/FORWARD set to DROP preventing any routing not explicitly allowed.
EDIT: added the return direction.
To make your experiment work this should be enough (including the retur... | Unable to ping external network from namespace, probably postrouting not working |
1,626,675,809,000 |
I am trying to experiment with DNAT in PREROUTING. I found a tutorial here. It contains the following sentence:
This is done in the PREROUTING chain, just as the packet comes in; this means that anything else on the Linux box itself (routing, packet filtering) will see the packet going to its 'real' destination.
I w... |
Your first question is already answered by the text you quoted:
This is done in the PREROUTING chain, just as the packet comes in;
this means that anything else on the Linux box itself (routing,
packet filtering) will see the packet going to its 'real'
destination.
I.e. routing and packet filtering.
For your s... | Changing Destination IP address using iptables and DNAT |
1,626,675,809,000 |
I'm trying to create a simple iptable rule using the command sample below. But the routing does not work. Any inputs on what is missing as I'm not familiar with iptables.
sudo iptables -t nat -A PREROUTING -p tcp -d 10.10.20.10 --dport 8321 -j DNAT --to-destination 192.168.56.101:8321
The ip 10.10.20.10 is not assigne... |
Traffic from the same host as where the nat PREROUTING DNAT rule is set does not traverse that nat PREROUTING chain, which is why you are not seeing it being applied.
Instead you need to use the nat OUTPUT chain for locally-generated packets:
sudo iptables -t nat -A OUTPUT -p tcp -d 10.10.20.10 --dport 8321 -j DNAT --... | iptable dnat rule not working ubuntu |
1,626,675,809,000 |
Basically I have a armbian distro configured as NAT where wlan0 is the internal interface and eth0 is the "pubic" interface that provides internet (this set is provided out of the box by armbian-config).
My devices connect over wlan0 grabbing an IP, say 172.24.1.114
I have added a VPN to a remote network resulting in ... |
I have resolved all.
First the required iptables' rules are (these give access to the remote VPN's machines):
-A FORWARD -i wlan0 -o ppp0 -j ACCEPT
-A POSTROUTING -o ppp0 -j MASQUERADE
Then, to indicate which IP or range of IPs have to have a different route, you need policy rules:
open /etc/iproute2/rt_tables and p... | NAT a specific IP to go to ppp0 and others to go to eth0 coming from internal wifi interface |
1,626,675,809,000 |
I made two Virtualbox virtual machines, CentOS 7 latest iso. I gave them each 2 network interfaces, one NAT and one "Internal network" in order to get them to talk to each other and have Internet access. I set manual IP addresses for each:
NAT interfaces: VM1: 10.0.2.15/24 - VM2: 10.0.2.16/24 Internal Network interfac... |
try
NAT interfaces: VM1: 10.0.2.15/24 - VM2: 10.0.2.16/24
Internal Network interfaces: VM1: 10.0.3.1/24 VM2 10.0.3.2/24
You will have trouble using same network on differents interfaces.
| Virtualbox - how to give Internet access and internal network access to two VMs? |
1,626,675,809,000 |
I'm using this rule to configure SNAT:
iptables -t nat -A POSTROUTING -o eth1 -j SNAT --to-source 193.49.142.107:4000
I want to specify a rule to filter out packets not destined to the internal address and port that initiated the session. Additionally, for receiving packets from a specific external endpoint, it is ne... |
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE
iptables -P FORWARD -j DROP
iptables -A FORWARD -o eth1 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth1 -m state --state ESTABLISHED -j ACCEPT
What do these rules do?
-A POSTROUTING -o eth1 -j MASQUERADE hides your internal IP's as packets l... | Configure NAT filtring behavior with iptables |
1,626,675,809,000 |
I have one subdomain (dyndns). xyz.dyndns.com (f.e.)
Here my question begins:
I have a server for virtualisation.
On the server I have multiple VMs
where different web-services are available through https.
My router is configured with xyz.dyndns.com
VMs can be accessed over NAT or be Bridged to router
How is it pos... |
The typical approach is to setup a web server such as Nginx or Apache on either the router/switch box, or have the router/switch box redirect ports 80 & 443 to a internal host that's running Nginx or Apache.
Once traffic has been setup so that it's passing to a web server, you can then setup virtual hosts within the w... | Redirection to services in NAT or Bridged Network only with one subdomain |
1,626,675,809,000 |
When installing pivpn on Raspberry Pi it will create an iptables rule:
pi@RPi64:~ $ sudo iptables -L -t nat
Chain PREROUTING (policy ACCEPT) ... |
Masquerading in general is used for access to one network from a second network where the first network isn't set up to route replies back to the second. You apply masquerading to packets going out the gateway to the first network (rewriting the packets' source address to use the gateway's address), so that other host... | Can I run PIVPN with Wireguard without MASQUERADING? |
1,626,675,809,000 |
I'm working from the answer of this question and man nft in order to create some dnat rules in my nftables config.
The relevant config extract is:
define src_ip = 192.168.1.128/26
define dst_ip = 192.168.1.1
define docker_dns = 172.20.10.5
table inet nat {
map dns_nat {
type ipv4_addr . ipv4... |
There are 3 problems.
no error is displayed
This looks to be a bug in nftables 1.0.6, see following bullets.
Here with the same version and OP's ruleset in /tmp/ruleset.nft:
# nft -V
nftables v1.0.6 (Lester Gooch #5)
[...]
# nft -f /tmp/ruleset.nft
/tmp/ruleset.nft:7:38-45: Error: unknown datatype ip_proto
t... | nftables dnat map rule failing silently |
1,626,675,809,000 |
I would like to change source address of every packet generated by a process in given cgroup (version 2). Is that even possible?
I have:
nftables 1.0.2,
linux 5.15 (Ubuntu variant)
/system.slice/system-my-service.slice/[email protected] cgroup
I have tried to:
create a table nft add table ip myservice
create a post... |
Here's an answer to your two problems:
syntax
cgroupv2 expects a path, which is a string. A string is always displayed with double-quotes, and requires double-quotes if it includes special characters. These double-quotes are for the nft command's consumption, not for the shell. With direct commands (ie: not in a file... | Can nftables perform postrouting matching on crgroupv2? |
1,626,675,809,000 |
When creating a dnat rule, you can specify the following command:
nft 'add rule ip twilight prerouting ip daddr 1.2.3.0/24 dnat ip prefix to ip daddr map { 1.2.3.0/24 : 2.3.4.0/24 }'
And then get dnat that maps addresses like 1.2.3.4 -> 2.3.4.4. This command runs as expected with nftables v1.0.4 (Lester Gooch #3)... |
TL;DR: You need at least nftables version >= 1.0.5.
In version 1.0.5:
scanner: allow prefix in ip6 scope
Which matches this commit:
scanner: allow prefix in ip6 scope
'ip6 prefix' is valid syntax, so make sure scanner recognizes it also
in ip6 context.
Also add test case.
[...]
diff --git a/tests/shell/te... | nftables anonymous map for ipv6 dnat |
1,626,675,809,000 |
I am using VirtualBox on Windows now.
The network is roughly like this:
[Fedora 37 VM] -- NAT network -- [Windows Host] ---- intranet ---- internet
I use DNS on intranet to resole host.domain names like both some.host.on.intranet and www.yahoo.co.jp .
On my windows host, this is OK.
But I am not so luky on my Fedora... |
You can't use .local like that. It's reserved for Multicast DNS (mDNS) lookups in an environment without managed DNS servers.
It's actually reserved for use with the full set of Zeroconf technologies, but the one relevant here is mDNS.
| Fedora VM behind NAT can not ping host.domain name on intranet |
1,626,675,809,000 |
I've set up a PPTPd server on an Ubuntu 18.04 machine with kernel 5.0x, am able to connect to it from a Win10 machine, ping the server and ping 8.8.8.8. So DNS works over VPN.
However, I'm not able to retrieve any web pages or connect to other ports.
I've done the modprobe things (nf_nat_pptp and nf_conntrack_pptp).
T... |
Definitely something wrong with iptables rules. I see a lot of overlapping. For example, take a close look at POSTROUTING chain. Rules #1, 2 and 3 are identical. Also, rules #6, 7 and 8 are identical.
Bear in mind that rules are processed from top to down. If you take another close look at POSTROUTING_ZONES chain. Rul... | PPTP VPN Ubuntu no web access |
1,626,675,809,000 |
I have a Linux box (let's call it Network Probe) that i would like to use for network monitoring. I need to redirect ALL the traffic for ALL the protocols coming to ETH0 to another machine (Network Mon) on the same subnet. Also i need to connect on the probe in SSH.
It's possible to redirect all the network traffic ex... |
Insert an ACCEPT before DNAT
iptables -t nat -I PREROUTING -p tcp --dport 22 -j ACCEPT
-I inserts it to the begining of the chain
| Redirect all network traffic except ssh |
1,626,675,809,000 |
Let's say, that one has following network topology:
NAT gateway linux-router has a following SNAT rule in place:
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
SNAT all -- 10.99.99.50 anywhere to:1.1.1.6
In addition, as seen on the drawing... |
netfilter is route-agnostic. That's the important thing that explains what happens below. netfilter's NAT handling alters addresses, and in some cases, when this is done before a route decision, this in turn alters the route decision. netfilter doesn't do route decisions itself: that's only the role of the routing sta... | Is there a point to configure SNAT source address in NAT gateway? |
1,626,675,809,000 |
I'm running this project for creating access points which is built on top of hostapd.
Running this works as expected, my ethernet connection is available as wifi:
sudo create_ap wlan0 eth0 wifiname
I was hoping that port 80 on my host machine would automatically be exposed to the client but it isn't.
How can I create... |
I was able to get the behavior I wanted using dnsmasq. Originally I was confused because I was adding the following to the default dnsmasq.conf location:
address=/#/192.168.12.1
It should forward all traffic to the IP 192.168.12.1 but I found it wasn't working.
Later on while running top with the program running I fo... | Forward ports over hostapd? |
1,626,675,809,000 |
I am having difficulties configuring NAT with iptables on my firewall.
My firewall setup is as follow:
it is a layer 2 transparent firewall, between my gateway and my ISP's gateway
I bridged two interfaces as br0. The two interfaces are eno0 on my ISP side and eno1 on my local network side
I set up basically no ipta... |
As suggested by @dirkt, it looks like conntrack does not work well with a bridge. So iptables rules that don't require seem to work on a bridge, but not NAT.
Problem solved as soon as I configured my firewall as a layer 3 firewall.
In case others are interested: I extensively searched the Web if it was possible to use... | Use NAT with iptables and a bridge |
1,626,675,809,000 |
I have two separate freeBSD VMs. In VM1 I added 2 interface.
em0: 192.168.1.0/24
em1: 192.168.2.0/24.
In VM2 I have one interface with
192.168.2.0/24
IP address.
In VM1 I started a NAT and now I want to see if it is work properly or not. I'm able to connect to internet with my VM2 ( internet is come through em0... |
You could use tcpdump -i em0 on VM1 and observe that all packets to and from VM1 have an address of VM1's em0 interface.
If you observe the same packets on em1, you will see this address translated.
| Setting up a NAT in VM |
1,626,675,809,000 |
I set up a virtual ethernet (veth) pair between default namespace and another namespace named RoutableNS as follow:
-------------- --------------
- veth0 - -------------- veth1 -
- 10.5.1.1 - - 10.5.1.2 -
-------------- --------------
default NS Ro... |
It's perfectly possible to masquerade or SNAT a device whose IP is not routable to the outside world. And being in a network namespace or not makes no difference.
You conveniently forgot to tell us what exactly you tried, but keep in mind that SNAT and MASQUERADE only work in the POSTROUTING table (while DNAT only wor... | SNAT to unroutable interface |
1,466,655,932,000 |
All
I have a Cisco 877 router and a Linode VPS running OpenBSD 5.9 with a GRE tunnel running in between, which works great and I can ping from either side. I have set up a static route in the Cisco router to route traffic to WhatsMyIP.org (so I can see if it's working) but, try as I might, I can't get OpenBSD's PF to... |
It seems that:
pass out on $ext_if from $int_net to any nat-to $ext_if
... doesn't work, it has to be this:
match out on $ext_if from $int_net to any nat-to $ext_if
pass on $ext_if from $int_net to any
Also, it helps to make sure net.inet.ip.forwarding is set to 1.
| Applying NAT to traffic from GRE tunnel in OpenBSD PF |
1,466,655,932,000 |
I want make a system that has a few subdomains. I set each subdomain to IP address using DNS.
I used random IP addresses for the question
165.93.198.34 x.mydomain.com (Which is actually 165.93.198.220:8080)
165.93.198.38 z.mydomain.com (Which is actually 165.93.198.220:81)
165.93.198.44 c.mydomain.com (Which is actual... |
If your target IP (165.93.198.220) is another system in the network
add an ACCEPT rule in the FORWARD chain like this:
iptables -A FORWARD -p tcp -d 165.93.198.220 --dport 8080 -j ACCEPT
also check if ip forward is enabled:
sysctl net.ipv4.ip_forward
if it is not set to 1, enable it on the fly with:
sysctl -w net.ip... | Answer redirect IP to specific port |
1,466,655,932,000 |
So, one of my servers is behind NAT, and since there is already a publicly accessible apache server going on my LAN, I decided to access it from the outside with different ports, and remap them to the standard port of the apache on this new machine I want to get a cert on. I did that with classic port forwarding via m... |
It's not possible to use non-standard port, as conforming ACME server will still try to contact default 80 / 443 for http-01 / tls-sni-01 challenges.
E.g.certbot has a separate options for to listen to non-standard port, but that still doesn't help to pass the challenge:
certonly:
Options for modifying h... | Changing the port letsencrypt tries to connect on |
1,466,655,932,000 |
Background: I am trying to set up an access point on Linux. The ultimate aim is to run SSLStrip (for an exercise) so I need to be able to do something like this, to redirect port 80 traffic through port 10000, on which SSLStrip listens.
iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port... |
Turns out it was network-manager interfering. Switched it off
service network-manager stop
and everything works fine.
I suspect there exists a less drastic solution than disabling it altogether, but it does what I need for now.
| Linux access point (airmon-ng/airmon-ng) not working |
1,466,655,932,000 |
eth0 (192.168.1.0/24) --> wan
eth2 (192.168.10.0/24) --> lan0
I use these rules to enable NAT on my linux gateway:
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth2 -o eth0 -j ACCEPT
iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
why on some online howto I read some... |
If you use these two lines:
iptables -A FORWARD -s 192.168.10.0/24 -j ACCEPT
iptables -A FORWARD -d 192.168.10.0/24 -j ACCEPT
Then these two has no value as far as the security is concerned:
iptables -A FORWARD -s 192.168.10.0/24 -d 0/0 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -d 192.168.10.... | linux nat different rules |
1,466,655,932,000 |
Desired scenario: a small subnetwork of Linux machines, all accessible through another Linux machine (acting as an IP router). These machines would be pre-configured with addresses on a private network (192.168.x.x or 10.x.x.x). However, each would be accessible though the routing machine with public IP addresses, one... |
Assuming, IP_EXT1 and IP_EXT2 are the external IP addresses for respectively machines #1 and #2, and IP_INT1 and IP_INT2 their respective internal IP addresses.
IP_EXT1 and IP_EXT2 are in fact addresses of the routing machine, either aliases for the same network interface or two distinct interfaces.
Then, the iptables... | Network translation, one to one, not one to many |
1,466,655,932,000 |
I have a linux SUSE host which has both ipv4 and v6 enabled, below are the interfaces:- eth0,app,eth1 however the default route is available for ipv4 via eth0. Kubernetes is running on this host(single node), and the cluster is in ipv6. I need help with some kind of mechanism to access my cluster from outside host, so... |
I was able to achieve this through socat,
socat TCP-LISTEN:<localhost_port>,reuseaddr,fork TCP6:[ipv6 cluster IP]:<port>
Just a concern, if we use this, as a daemon service, will there be any security concerns or impact ?
| Packet forwarding from dual stack interface to localhost |
1,466,655,932,000 |
Our router machine has multiple public IPs (/27) on its WAN interface. Now, I want to add dnat rules which match specific dport/saddr/daddr combinations.
My dream would be something like this:
map one2one_dnat {
# dst_addr . src_addr . proto . dst_port : dnat_to . dnat_to_port
type ipv4_addr . ... |
The idea was here but with a wrong syntax used for the named map case, while the proper syntax was used for the anonymous map case.
A map replaces a key with this key's value if found (or the expression just evaluates to false, stopping further processing). Even when used along a dnat rule a map named keytovalue must ... | Nftables: Dnat with source address restriction and just one map |
1,466,655,932,000 |
My goal is to run two Docker containers on separate networks and have my host (Ubuntu 22.04) perform NAT so that the first network can reach the second.
My setup:
docker network create network1
docker network create network2
docker run --rm -it --network network1 ubuntu:22.04 bash
# In other terminal
docker run --rm... |
The issue is the following iptables rules:
Chain FORWARD (policy DROP)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION-STAGE-1 all -- anywhere anywhere
...
Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target prot opt source de... | Set up NAT between Docker networks |
1,466,655,932,000 |
88.198.49.xxx = Hetzner (will run virtual machines on this)
141.94.176.xxx = OVH (contains block below)
164.132.xxx.0/28 = IP block to use on Hetzner as virtual machines
To get GRE set up I ran the following:
OVH:
ip tunnel add gre1 mode gre remote 88.198.49.xxx local 141.94.176.xxx ttl 255
ip link set gre1 up
ip rout... |
The IP addresses 88.198.49.xxx and 164.132.xxx.1 represent the same system: the hypervisor acting as router at Hetzner.
So when the target is this system itself, it will answer back with the address it was contacted with: 164.132.xxx.1. When it's acting as a router for 164.132.xxx.2, it will generate an ICMP TTL expir... | GRE IP to virtual machine (Proxmox) - Traceroute showing full route |
1,466,655,932,000 |
I'm building a captive portal (yeah, just-another ;) )
and now I'm trying to handle the core feature, the iptables rules.
Based on ipset I have a list of valid mac-addresses with name allow-mac.
So this is the current config (stripped to the problem itself):
echo 1 >/proc/sys/net/ipv4/ip_forward
ipset create allow-... |
In the first ruleset, you only allow outgoing traffic as you specified -i $LAN: so the reply will be filtered out. It will probably work simply by removing -i $LAN` ?
But in this case the whole traffic will be counted (upload + download)
If you want to count separately upload and download, you'll probably have to crea... | iptables - allow forward rules by set |
1,466,655,932,000 |
There is the requirement to set up a stateless NAT for two UDP connections from a physical network adapter in global network namespace via a linked pair of virtual network adapters to a service running in a special network namespace. This should be done on a CPU (Intel Atom) in an industrial device running Linux (Debi... |
I found the solution by myself finally after many, many hours of reading documentations, tutorials, suggestions on various web pages, making lots of trials, and doing deep and comprehensive network and netfilter monitorings and analyzes.
nft add table ip prot1
nft add chain ip prot1 prerouting '{ type filter hook prer... | How to set up stateless NAT for two UDP connections from a global network to special network namespace? |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.