output
stringlengths
9
26.3k
input
stringlengths
26
29.8k
instruction
stringlengths
14
159
Since you mention zsh, you could do: zmodload zsh/mapfile mapfile[$attic]=${(pj:\0:)"${(0@)mapfile[$attic]}":#$i}$mapfile in the zsh/mapfile module is a special associative array that maps file names to their content. "${(0@)var}": splits $var on NULs (and with @ inside quotes preserves empty elements like "$@"). ${array:#pattern}. removes the elements that match the pattern. Here the content of $i is taken literally, you'd need $~i for it to be taken as a pattern (or enable the globsubst option). ${(j:string:)array}: joins the elements of the array with string. With p, \0 is converted to NUL. (note that the 0 parameter expansion flag above can also be written ps:\0:).You can get something similar with perl with: FROM=$i perl -0lni -e 'print if $_ ne $ENV{FROM}' -- "$attic"The difference being that perl will add a NUL at the end if there was not one already (and the usual problems with-i (breaking links, not preserving all metadata...)). A closer equivalent would be: FROM=$i perl -0777 -F'\0' -pi -e ' $_ = join "\0", grep {$_ ne $ENV{FROM}} @F' -- "$attic"YourFROM="$i" perl -pi0 -e 's/\0\Q$ENV{FROM}\E//g' "$attic"doesn't work because:in -pi0: the 0 is taken as the argument to -i (the backup filename suffix) even if you had written -0pi, that couldn't have worked as that tells perl to process NUL-terminated records, so the record ($_) will have the NUL at the end, not beginning. Use -0777 for perl to process the input as one record containing the whole input.
I have an array of values v that I want to remove from the file f. f is NUL delimited. How do I proceed? I tried using sd, but it didn't work. Example: I have this file: # cat -v $attic ^@this is 1. this is 2. this is 3. ^@hi ^@blue boyAnd this variable $i: # cat -v <<<"$i" this is 1. this is 2. this is 3.I want a command that removes $i from that file, resulting in: ^@hi ^@blue boyI have tried FROM="$i" perl -pi -e 's/\0\Q$ENV{FROM}\E//g' "$attic", but it doesn't work if $i is multiline. I tried FROM="$i" perl -pi0 -e 's/\0\Q$ENV{FROM}\E//g' "$attic" but this didn't do anything.
Remove values from NUL separated file
"A null string" means "a zero length (empty) string". See e.g. the POSIX definition of "null string". This means that there is no such thing as a non-null zero length string. However, there is such a thing as an unset variable. var='' unset uvarThere's now a difference between var and uvar after running the above code. For example, ${var-hello} would expand to the empty string since var is set, while ${uvar-hello} would expand to hello since uvar is unset. Likewise, ${var+hello} would expand to hello since var is set, and ${uvar+hello} would expand to an empty string since uvar is unset (see standard parameter expansions) In bash, you can also use the -v test to test whether a variable is set or not: if [ -v variable ]; then echo variable is set fiAgain, a variable being "set but empty" is different from a variable being "unset". A string (contents of a variable) can't be null and at the same have non-zero length. In other languages, an array of characters may contain nul bytes (\0), which means that you may have an array starting off with a nul byte, and then containing some text after that (terminated with another nul byte). When that is interpreted as a string, that string would have zero length, but the contents of the array would not be empty. Most shells (apart from zsh) does not allow nul bytes in variables though.
Based on this, amongst many other things I've read, my understanding is that a='' makes a both null and zero-length. But, then, how does one create a zero-length, non-null string? Or, is there no such thing? To the extent this is shell-dependent, I'm working in bash.
How to assign a zero-length, non-null string
I think I understand what's the issue now. Actually... Not an issue, a behavior. If I intentionally input an invalid option, Dig gives me a syntax error. $ dig @8.8.8.8 google.com -A Invalid option: -A Usage: dig [@global-server] [domain] [q-type] [q-class] {q-opt} {global-d-opt} host [@local-server] {local-d-opt} [ host [@local-server] {local-d-opt} [...]]Use "dig -h" (or "dig -h | more") for complete list of optionsIf I do the same, but redirecting stderr to null, Dig shows me nothing. $ dig @8.8.8.8 google.com -A 2> /dev/nullTherefore, it seems Dig is correctly redirecting errors to null, not to stdout. Now, if I input an incorrect or unresponsive nameserver, Dig actually tells me that it did not get an answer, connection timed out; no server could be reached. Dig does not see that as an error. Also, it returns code 9, which means "No reply from server". In other words, no DNS service could be reached with the provided nameserver. As I understand it, "no server could be reached" might not be the best response. Maybe changing the term server to service would enhance that response a bit. @schrodingerscatcuriosity comment makes more sense to me now and seems to be a possible way to handle Dig's response in my script. But, since the actual IP response is required, redirecting all output to null (&> /dev/null) is not desired. I've add a work around to suppress the timeout output. for host in $(cat "$namefile"); do result="OK" IPADD=$(dig +timeout=1 +short "$host" "$domain" A 2> /dev/null) echo $IPADD | grep -s -q "timed out" && { IPADD="Timeout" ; result="FAIL" ; } echo "$result - Nameserver: $host - Domain: $domain - IP answer: $IPADD" done
I'm trying to test some nameservers against a domain name. For that, I created a script that reads a list of nameservers and asks for a domain name. Something basic like this: #!/bin/bashdomain=$1 [ -z $domain ] && read -p "DOMAIN NAME: " domainnamefile="./nameserver"echo "RESULT - NAMESERVER DOMAIN IP"for host in $(cat "$namefile"); do IPADD=$(dig +short "$host" "$domain" A 2> /dev/null) [[ ! -z $IPADD ]] && result="OK" || result="FAIL" echo "$result - Nameserver: $host - Domain: $domain - IP answer: $IPADD" doneThe issue I'm having is that, when Dig fails, it is not redirecting errors to null. Thus, the $IPADD variable receives a wrong value. # CORRECT nameserver # dig +short @8.8.8.8 google.com A 2> /dev/null 142.250.218.206# WRONG nameserver # dig +short @8.8.8.80 google.com A 2> /dev/null ;; connection timed out; no servers could be reachedIf I test it with a wrong nameserver address, I still get an error message, like shown above. As I understand, when redirecting to null, it should not display that error message. Any idea? Thank you.
Error redirection fail with bind - dig
pgrep -f matches on the concatenation with SPC characters of the arguments passed to the last command the process executed (as seen in /proc/pid/cmdline on Linux). That never contains NUL characters. So you'd need to do: pgrep -f '^[^ ]*foo( |$)'Though you'd miss the processes that have executed some command with /path/with space/foo as argv[0] and it would report processes that have execute a command with foo bar as argv[0]. In any case, you can't pass a NUL in an argument to a command that is executed as command arguments are NUL-delimited strings. In zsh, you can pass NUL to builtin commands and functions (as those are not affected by that limitation of execve() since they are not executed). So on Linux, you could do: print -rC1 /proc/<->(Ne[$'[[ "${$(<$REPLY/cmdline)%%\0*}" = *foo ]]']:t)to find the processes whose argv[0] ends in foo. Or: print -rC1 /proc/<->/exe(N-.e['[[ $REPLY:A = *foo ]]']:h:t)For those that are executing a command whose path ends in foo (though you may be limited to your own processes). On Linux, process names are limited to 15 bytes and are changed to the first 15 bytes of the basename of the first argument to each call they make to execve(), though can also be changed by writing to /proc/pid/comm or with prctl(PR_SET_NAME). Processes can also change what's in /proc/pid/cmdline. See for instance: $ perl -lne 'BEGIN{$0 = "foo bar 90123456789"}; print "$ARGV: $_"' /proc/self/{cmdline,comm} /proc/self/cmdline: foo bar 90123456789 /proc/self/comm: foo bar 9012345
I'd like to kill a process with a long name that ends with foo. Currently my plan is to use pkill (though for testing, to be friendly to the process, I've been checking my patterns with pgrep instead). I've seen this question that shows that for long process names, you must use -f to get the whole command line. The works great for getting the rest of the long process name; the problem is that then the pattern is matched against the whole command line rather than just the process name, and I would not like to accidentally kill a different program that happened to have foo as an argument. So I believe I would like to write a pattern something like this: pgrep -f '^[^\0]*foo'where I've written \0 to mean a zero byte -- the separator that -f puts before each argument to a process. Of course \0 doesn't work; this pattern actually matches any sequence of characters that are not \ or (ASCII) 0 instead. I also tried this: pgrep -f '^[^'`echo -n '\0'`']*foo'Here I have confirmed that my shell produces a single 0 byte for echo -n '\0'. Unfortunately, because of the way arguments are passed, pgrep stops scanning a pattern when it sees an actual 0 byte, so this command behaves exactly the same as pgrep -f '^[^' would -- that is, it throws an error about receiving an invalid pattern. How can I write a pattern that refers to a zero byte in it (or, well, any byte that isn't a zero byte)?
how to write a pgrep pattern that (never) matches a zero byte?
tr -d '\0' <file >newfileThis deletes all nul bytes in the file file and saves the modified data in newfile.
I've got a file of data from a prototype hardware RNG, however, for some reason it's producing a lot of 0x00 bytes. I want to delete all of these 0x00 bytes so I can test if the rest of the data is random. How would I go about doing this in the terminal?
Remove all zero bytes from file in Unix
The null device acts like a black hole. Anything written to it is discarded, and if you try to read from it you receive an end-of-file immediately. It is used to discard unwanted output and to provide null input. Without it, it would be very hard to discard unwanted output. Basically, you would have to store the unwanted output in a file that you then deleted, or write a program that consumed all the data without doing anything to it. Similarly, you would have to create an empty file to provide an immediate end-of-file to processes that you didn't want to, e.g., read from standard input. The presence of /dev/null is mandated by the POSIX standard, and it says that it is...An empty data source and infinite data sink. Data written to /dev/null shall be discarded. Reads from /dev/null shall always return end-of-file (EOF).It is one of only three devices under /dev that needs to be available on a POSIX system. The others are /dev/tty and /dev/console. Reference: http://pubs.opengroup.org/onlinepubs/9699919799/toc.htm
Tried echo "Some text" >> /dev/null then cat null with no output. Can someone explain why this is?
What happens when you write to /dev/null? What’s the point? [duplicate]
This is the script for Reader, which should be close to what you need to fake a tail command for a NUL-filled file. It checks for changes in the file (by comparing the whole ls -l output, which includes a timestamp down to nanoseconds), and reports any additions in a batch. It does not report lines that are already in the file when it starts up, only additions while it is running. It runs at two speeds to avoid wasted checks. If it detects any additions, it tries again after 1.0 seconds. If a cycle sees no additions, it tries again after 5 seconds (this 5 is an argument to the process). #! /bin/bash #: Reader: tail -f a file which is pre-formatted with many trailing NUL characters.#### Implement the User Requirement.function Reader { local RUN="${1:-60}" SLEEP="${2:-5}" FILE="${3:-/dev/null}" local AWK=''' BEGIN { NUL = "\000"; } function Tick (Local, cmd, ts) { cmd = "date \047+%s\047"; cmd | getline ts; close (cmd); return (ts); } function TS (Local, cmd, ts) { cmd = "date \047+%H:%M:%S.%N\047"; cmd | getline ts; close (cmd); return (ts); } function Wait (secs) { system (sprintf ("sleep %s", secs)); } function isChange (Local, cmd, tx) { cmd = sprintf ("ls 2>&1 -l --full-time \047%s\047", Fn); cmd | getline tx; close (cmd); if (tsFile == tx) return (0); tsFile = tx; if (index (tx, "\047")) { if (fSt != "B") { fSt = "B"; printf ("%s: No file: %s\n", TS( ), Fn); } } else { if (fSt != "G") { fSt = "G"; printf ("%s: Reading: %s\n", TS( ), Fn); } } return (1); } function atNul (buf, Local, j) { j = index (buf, NUL); return ((j > 0) ? j : 1 + length (buf)); } function List (tx, Local, ts, X, j) { sub ("\012$", "", tx); split (tx, X, "\012"); ts = TS( ); for (j = 1; j in X; ++j) { printf ("%s %3d :%s:\n", ts, length (X[j]), X[j]); } } function Monitor (Local, rs, tk, Buf, Now, End) { printf ("%s: READER Begins\n", TS( )); tk = Tick( ); Expired = tk + Run; Now = -1; while (Tick( ) <= Expired) { if (! isChange( )) { Wait( Sleep); continue; } rs = RS; RS = "\000"; Buf = ""; getline Buf < Fn; close (Fn); RS = rs; if (Now < 0) Now = atNul( Buf); End = atNul( Buf); List( substr (Buf, Now, End - Now)); Now = End; Wait( 1.0); } printf ("%s: READER Exits\n", TS( )); } NR == 1 { Run = $0; next; } NR == 2 { Sleep = $0; next; } NR == 3 { Fn = $0; } END { Monitor( Fn); } ''' { echo "${RUN}"; echo "${SLEEP}"; echo "${FILE}"; } | awk -f <( echo "${AWK}" ) }#### Script Body Starts Here. Reader 40 5 "./myNullFile"
I have a 10Mb file filled by null bytes. A program is accessing it and changes zeros to specific strings up to the end of the file. I've tried to use tail -F | grep wanted_text | grep -v "unwanted_text", but it does not monitor changes. It only works for usual text files, but not for files filled by zeros. All null bytes are replaced by lines separated by a new line character till the end of the file. After the file is filled up it is being renamed and the new one is created instead. So how could I monitor changes of a file filled by null bytes with ability to filter output?
How to monitor changes in file filled by null bytes?
From the implementation of the shell in busybox: /* * Fork off a subshell. If we are doing job control, give the subshell its * own process group. Jp is a job structure that the job is to be added to. * N is the command that will be evaluated by the child. Both jp and n may * be NULL. The mode parameter can be one of the following: * FORK_FG - Fork off a foreground process. * FORK_BG - Fork off a background process. * FORK_NOJOB - Like FORK_FG, but don't give the process its own * process group even if job control is on. * * When job control is turned off, background processes have their standard * input redirected to /dev/null (except for the second and later processes * in a pipeline). * * Called with interrupts off. */Note "input redirected to /dev/null". Since subshells have their standard input redirected from /dev/null (and it will be, since job control is turned off, which it will be because /dev/tty is also not accessible), you'd get an error if that device file is not accessible.
I'm curious why this special device is needed to fork the command and run it asynchronously in the minimal Busybox shell. BusyBox v1.30.1 (Debian 1:1.30.1-4) built-in shell (ash) Enter 'help' for a list of built-in commands./bin/sh: can't access tty; job control turned off / # / # echo Hello && sleep 2s && echo World & /bin/sh: / # can't open '/dev/null': No such file or directory/ # / # mknod /dev/null c 1 3 && chmod 666 /dev/null / # echo Hello && sleep 2s && echo World & / # Hello World/ #
Why is /dev/null needed to run asynchronous jobs in busybox sh?
Because xargs -0 == xargs -0 echo where the default echo will print new line at the end of a string, You can achive the same output with -n find . -print0 | sort --zero-terminated | xargs -0 -n1 echo -n
In the example, why xargs -0 adds an extra blank line, and how to avoid it? $ touch a b c $ find . -print0 ../a./c./b $ find . -print0 | sort --zero-terminated | xargs -0 . ./a ./b ./c $ find . -print0 | sort --zero-terminated ../a./b./c$ Note that the last output is ../a./b./c$ i.e. the $ sign for input is on the same line without a new line.
Why xargs -0 adds an extra blank line?
You need to be aware of what command is doing the output to stderr and make sure the redirection is associated with that command. You can think of pipes as having ( ) around the commands So a | b | ccan be thought of as ( a ) | ( b ) | (c )(That's not literally how it works, but it's a mental model). And the redirection happens inside the brackets. So it's clear that ( a ) | ( b ) | ( c 2>/dev/null )doesn't redirect the error message from "a" but ( a 2>/dev/null) | ( b ) | ( c )does And so, your command redirected the error from the awk command. You really want to redirect the error from ldapsearch. So $ ldapsearch -Y GSSAPI -b "cn=users,cn=accounts,dc=example,dc=com" "uid=foo" 2>/dev/null | grep krbPasswordExpiration | tail -n1 | awk '{print $2}'
I have very simple command which generating STDOUT which i want to do /dev/null but somehow it's not working or i am missing something here. $ ldapsearch -Y GSSAPI -b "cn=users,cn=accounts,dc=example,dc=com" "uid=foo" | grep krbPasswordExpiration | tail -n1 | awk '{print $2}' SASL/GSSAPI authentication started SASL username: [emailprotected] SASL SSF: 256 SASL data security layer installed. 20200608022954Z <---- This is my krbPasswordExpiration value.But if you see in above command SASL line which is just stdout which i want to do /dev/null so i have tried following but it seems not working. $ ldapsearch -Y GSSAPI -b "cn=users,cn=accounts,dc=example,dc=com" "uid=foo" | grep krbPasswordExpiration | tail -n1 | awk '{print $2}' 2> /dev/nullwhat other way i can get rid of it?
command stdout to /dev/null
tee will block waiting for standard input. If your system provides the truncate command, you can try sudo truncate -s 0 /var/www/html/nohup.outOtherwise, you could do something like : | sudo tee /var/www/html/nohup.outto supply tee with an empty stdin.
My logs nohup.out is owned by root user while I m trying to rotate the logs using system which has privileged access using sudo I have written the below script to rotate logs. cat rotatelog.sh cp /var/www/html/nohup.out /var/www/html/nohup.out_$(date "+%Y.%b.%d-%H.%M.%S"); sudo tee /var/www/html/nohup.out;The issue is when I run rotatelog.sh it does the job but the control does not return to the command line terminal. i tried > /var/www/html/nohup.out but I get Permission denied error. How can I get the logs rotated and return to the command-line?
Trying to rotate logs however tee command fails to return after execution
I know this bit old; but it seems like no one answered this satisfactorily, and the requester never posted if his problem was solved or not. So here is an explanation. When you perform: # crm resource migrate r0 node2a cli-prefer-* rule is created. Now when you want to move the r0 back to node1, you don't do: # crm resource migrate r0 node1but you perform: # crm resource unmigrate r0Using umigrate or unmove gets rid of the cli-prefer-* rule automatically. If you try to delete this rule manually in cluster config, really bad things happen in cluster, or at least bad things happened in my case.
Using pacemaker in a 2 nodes master/slave configuration. In order to perform some tests, we want to switch the master role from node1 to node2, and vice-versa. For instance if the current master is node1, doing # crm resource migrate r0 node2does indeed move the resource to node2. Then, ideally, # crm resource migrate r0 node1would migrate back to node1. The problem is that migrate added a line in the configuration to perform the switch location cli-prefer-r0 r0 role=Started inf: node2and in order to migrate back I have first to remove that line... Is there a better way to switch master from one node to the other?
Pacemaker: migrate resource without adding a "prefer" line in config
If your goal is to just stop the resource from running on any nodes in a cluster then you'd want to disable that resource using: pcs resource disable ClusterIP-01 Your command sudo pcs cluster stop --all would be shutting down the cluster itself (and any resources controlled by that cluster). Managing Cluster Resources
I have recently installed pacemaker and corosync for managin a virtual IP. The thing is that when I want to stop a resource (Virtual IP) on all the nodes, the stop command hangs. [root@isis ~]# sudo pcs cluster stop --all isis: Stopping Cluster...My configuration is: [root@isis ~]# sudo pcs status Cluster name: cluster-osiris Last updated: Mon Dec 8 00:09:29 2014 Last change: Mon Dec 8 00:09:24 2014 via cibadmin on isis Stack: corosync Current DC: horus (2) - partition with quorum Version: 1.1.10-32.el7_0.1-368c726 2 Nodes configured 2 Resources configuredOnline: [ horus isis ]Full list of resources: HAproxy (systemd:haproxy): Started horus ClusterIP-01 (ocf::heartbeat:IPaddr2): Started isisPCSD Status: isis: Online horus: OnlineDaemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabledIf i stop cluster node by node, it works well: [root@isis ~]# sudo pcs cluster stop horus horus: Stopping Cluster... [root@isis ~]# sudo pcs cluster stop isis isis: Stopping Cluster... [root@isis ~]# sudo pcs status Error: cluster is not currently running on this nodePlease, Could you help me with this issue? Tks!
pacemaker hangs while stopping
You're using the wrong action in your ordering constraint. 'promote' should only be used on Master/Slave resources, use 'start' on your groups. pcs constraint order start SQL-Group then ASTERISK-Group
I have a group in Pacemaker which I need to start last. Ideally I'd like to know how to configure groups to start in an specific order, but I can't seem to figure it out, not sure if its possible. Seems like it should be, I love using groups as it helps me organize and makes reading what's going on in the config much easier. What I'd like to do with 2 groups: pcs resource group add ASTERISK-Group Asterisk FOP2pcs resource group add SQL-Group varlibmysql sql_servicepcs constraint order promote SQL-Group then ASTERISK-GroupBut it just says that SQL-Group doesn't exist. Note: CentOS 7 Updated
Pacemaker Promote Groups in Specific Order - Or Specify start last
I don't see mysql defined in the Pacemaker; are you starting it manually after the cluster starts or does it start at boot? If it's starting at boot, it could be starting before Pacemaker, and therefore holding a lock on the mountpoint (where it's data should be) which would cause the Filesystem resource to not be able to mount the filesystem there. Kind of a shot in the dark, but if that's the case, you should disable mysql from starting at boot and then define it in the cluster.
So I have gotten to the point where I had all services running when I configured the cluster, but after reboot I am getting the following : Full list of resources: virtual_ip (ocf::heartbeat:IPaddr2): Started node1 webserver (ocf::heartbeat:apache): Stopped Master/Slave Set: WebDataClone [WebData] Masters: [ node2 ] Slaves: [ node1 ] WebFS (ocf::heartbeat:Filesystem): Started node2 sqlfs (ocf::heartbeat:Filesystem): Stopped Master/Slave Set: SQLDataClone [SQLData] Masters: [ node1 ] Slaves: [ node2 ]Failed actions: sqlfs_start_0 on node1 'unknown error' (1): call=26, status=complete, last-rc-change='Sat Jun 4 00:57:27 2016', queued=0ms, exec=32ms sqlfs_start_0 on node2 'unknown error' (1): call=34, status=complete, last- rc-change='Sat Jun 4 00:57:27 2016', queued=0ms, exec=59msThis is what I used for my SQL Configuration : resource sqldata { protocol C; disk /dev/sdb2; device /dev/drbd1; startup { wfc-timeout 30; outdated-wfc-timeout 20; degr-wfc-timeout 30; } net { cram-hmac-alg sha1; shared-secret sync_disk; } syncer { rate 10M; al-extents 257; on-no-data-accessible io-error; verify-alg sha1; } on node1.freesoftwareservers.com { address 192.168.1.218:7788; flexible-meta-disk internal; } on node2.freesoftwareservers.com { address 192.168.1.221:7788; meta-disk internal; } }Start DRBD and sync : drbdadm -- --overwrite-data-of-peer primary sqldata drbdadm primary --force sqldata watch cat /proc/drbdModified my.cnf gets changed on BOTH servers : service mysqld stop sudo nano /etc/my.cnf Change in /etc/my.cnf :#bind-address = 127.0.0.1 #Make Virtual_IP bind-address = 192.168.1.215 #datadir=/var/lib/mysql #Where DRBD will Mount datadir=/var/lib/mysql_drbd Mount and Populate with Data :Mount and Populate drbd1 : /sbin/mkfs.ext4 /dev/drbd1 mkdir /mnt/drbd1 mount /dev/drbd1 /mnt/drbd1 mv /var/lib/mysql_drbd/* /mnt/drbd1/ chcon -R --reference=/var/lib/mysql /mnt/drbd1 umount /dev/drbd1THIS IS THE CONFIG THAT SEEMS TO FAIL : pcs cluster start --all pcs cluster cib sqlfs_cfg pcs -f sqlfs_cfg resource create sqlfs ocf:heartbeat:Filesystem device="/dev/drbd1" directory="/var/lib/mysql_drbd" fstype="ext4" pcs -f sqlfs_cfg constraint colocation add sqlfs with SQLDataClone INFINITY with-rsc-role=Master pcs -f sqlfs_cfg constraint order promote SQLDataClone then start sqlfs pcs -f sqlfs_cfg constraint colocation add webserver with sqlfs INFINITY pcs -f sqlfs_cfg constraint order sqlfs then webserver pcs -f sqlfs_cfg constraint pcs -f sqlfs_cfg resource show pcs cluster cib-push sqlfs_cfgsqlfs_drbd_cfg : pcs cluster start --all pcs cluster cib sqlfs_drbd_cfg pcs -f sqlfs_drbd_cfg resource create SQLData ocf:linbit:drbd drbd_resource=sqldata op monitor interval=60s pcs -f sqlfs_drbd_cfg resource master SQLDataClone SQLData master-max=1 master- node-max=1 clone-max=2 clone-node-max=1 notify=true pcs -f sqlfs_drbd_cfg resource show pcs cluster cib-push sqlfs_drbd_cfgSet Prefered Location on node1 AKA Primary : pcs constraint location sqlfs prefers node1=50Any thoughts on how to troubleshoot this? Again, it worked during initial config, and broke after reboot... Thanks!
MySQL DRBD Resource failing to start PaceMaker + Corosync
It looks like you have the STONITH devices configured to be able to fence both nodes. You also do not have location constraints keeping the fence agents responsible for fencing a given node from running on that same node (STONITH suicide), which is a bad practice. Try configuring the STONITH devices and location constraints like this instead: pcs stonith create kvm_aquila-01 fence_ilo4 pcmk_host_list=kvm_aquila-01 ipaddr=10.0.4.39 login=fencing passwd=0ToleranciJa op monitor interval=60s pcs stonith create kvm_aquila-02 fence_ilo4 pcmk_host_list=kvm_aquila-02 ipaddr=10.0.4.49 login=fencing passwd=0ToleranciJa op monitor interval=60s pcs constraint location kvm_aquila-01 avoids kvm_aquila-01=INFINITY pcs constraint location kvm_aquila-02 avoids kvm_aquila-02=INFINITY
I have configured a two node physical server cluster (HP ProLiant DL560 Gen8) using pcs (corosync/pacemaker/pcsd). I have also configured fencing on them using fence_ilo4. The weird thing will happen if one node goes down (under DOWN i mean power OFF), the second node will die as well. Fencing will kill itself causing both servers to be offline. How do i correct this behavior? The thing i tried is to add "wait_for_all: 0" and "expected_votes: 1" in /etc/corosync/corosync.conf under quorum section. But it will still kill it. At some point, some maintenance is to be performed on one of those servers, and it will have to be shutdown. I don't want for the other node to go down if this happens. Here are some outputs [root@kvm_aquila-02 ~]# pcs quorum status Quorum information ------------------ Date: Fri Jun 28 09:07:18 2019 Quorum provider: corosync_votequorum Nodes: 2 Node ID: 2 Ring ID: 1/284 Quorate: YesVotequorum information ---------------------- Expected votes: 2 Highest expected: 2 Total votes: 2 Quorum: 1 Flags: 2Node Quorate Membership information ---------------------- Nodeid Votes Qdevice Name 1 1 NR kvm_aquila-01 2 1 NR kvm_aquila-02 (local)[root@kvm_aquila-02 ~]# pcs config show Cluster Name: kvm_aquila Corosync Nodes: kvm_aquila-01 kvm_aquila-02 Pacemaker Nodes: kvm_aquila-01 kvm_aquila-02Resources: Clone: dlm-clone Meta Attrs: interleave=true ordered=true Resource: dlm (class=ocf provider=pacemaker type=controld) Operations: monitor interval=30s on-fail=fence (dlm-monitor-interval-30s) start interval=0s timeout=90 (dlm-start-interval-0s) stop interval=0s timeout=100 (dlm-stop-interval-0s) Clone: clvmd-clone Meta Attrs: interleave=true ordered=true Resource: clvmd (class=ocf provider=heartbeat type=clvm) Operations: monitor interval=30s on-fail=fence (clvmd-monitor-interval-30s) start interval=0s timeout=90s (clvmd-start-interval-0s) stop interval=0s timeout=90s (clvmd-stop-interval-0s) Group: test_VPS Resource: test (class=ocf provider=heartbeat type=VirtualDomain) Attributes: config=/shared/xml/test.xml hypervisor=qemu:///system migration_transport=ssh Meta Attrs: allow-migrate=true is-managed=true priority=100 target-role=Started Utilization: cpu=4 hv_memory=4096 Operations: migrate_from interval=0 timeout=120s (test-migrate_from-interval-0) migrate_to interval=0 timeout=120 (test-migrate_to-interval-0) monitor interval=10 timeout=30 (test-monitor-interval-10) start interval=0s timeout=300s (test-start-interval-0s) stop interval=0s timeout=300s (test-stop-interval-0s)Stonith Devices: Resource: kvm_aquila-01 (class=stonith type=fence_ilo4) Attributes: ipaddr=10.0.4.39 login=fencing passwd=0ToleranciJa pcmk_host_list="kvm_aquila-01 kvm_aquila-02" Operations: monitor interval=60s (kvm_aquila-01-monitor-interval-60s) Resource: kvm_aquila-02 (class=stonith type=fence_ilo4) Attributes: ipaddr=10.0.4.49 login=fencing passwd=0ToleranciJa pcmk_host_list="kvm_aquila-01 kvm_aquila-02" Operations: monitor interval=60s (kvm_aquila-02-monitor-interval-60s) Fencing Levels:Location Constraints: Ordering Constraints: start dlm-clone then start clvmd-clone (kind:Mandatory) Colocation Constraints: clvmd-clone with dlm-clone (score:INFINITY) Ticket Constraints:Alerts: No alerts definedResources Defaults: No defaults set Operations Defaults: No defaults setCluster Properties: cluster-infrastructure: corosync cluster-name: kvm_aquila dc-version: 1.1.19-8.el7_6.4-c3c624ea3d have-watchdog: false last-lrm-refresh: 1561619537 no-quorum-policy: ignore stonith-enabled: trueQuorum: Options: wait_for_all: 0[root@kvm_aquila-02 ~]# pcs cluster status Cluster Status: Stack: corosync Current DC: kvm_aquila-02 (version 1.1.19-8.el7_6.4-c3c624ea3d) - partition with quorum Last updated: Fri Jun 28 09:14:11 2019 Last change: Thu Jun 27 16:23:44 2019 by root via cibadmin on kvm_aquila-01 2 nodes configured 7 resources configuredPCSD Status: kvm_aquila-02: Online kvm_aquila-01: Online [root@kvm_aquila-02 ~]# pcs status Cluster name: kvm_aquila Stack: corosync Current DC: kvm_aquila-02 (version 1.1.19-8.el7_6.4-c3c624ea3d) - partition with quorum Last updated: Fri Jun 28 09:14:31 2019 Last change: Thu Jun 27 16:23:44 2019 by root via cibadmin on kvm_aquila-012 nodes configured 7 resources configuredOnline: [ kvm_aquila-01 kvm_aquila-02 ]Full list of resources: kvm_aquila-01 (stonith:fence_ilo4): Started kvm_aquila-01 kvm_aquila-02 (stonith:fence_ilo4): Started kvm_aquila-02 Clone Set: dlm-clone [dlm] Started: [ kvm_aquila-01 kvm_aquila-02 ] Clone Set: clvmd-clone [clvmd] Started: [ kvm_aquila-01 kvm_aquila-02 ] Resource Group: test_VPS test (ocf::heartbeat:VirtualDomain): Started kvm_aquila-01Daemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabled
PCS Stonith (fencing) will kill two node cluster if first is down
Are you sure? I have it in PCS version 0.9.158 (CentOS 7.4): # pcs node attribute --helpUsage: pcs node <command> attribute [[<node>] [--name <name>] | <node> <name>=<value> ...] Manage node attributes. If no parameters are specified, show attributes of all nodes. If one parameter is specified, show attributes of specified node. If --name is specified, show specified attribute's value from all nodes. If more parameters are specified, set attributes of specified node. Attributes can be removed by setting an attribute without a value.Also, crmsh isn't deprecated. It's still an active project: https://github.com/ClusterLabs/crmsh
I know crm utility command has been people's preferred method to manage clusters when it comes to High Availability with corosync & pacemaker. Now, its been deprecated and we are told to work with pcs utility commands which suppose to do all sort of things that we used to do with crm. Now what I am troubling with is to find the pcs equivalent command to; crm node attribute <node_name> set <resource_name> <some_parameters>. If I try with pcs node, there is no any such command set available. I am at CentOS 7.2 version & working with Percona master-slave cluster.
Corosync/Pacemaker pcs equivalent commands to crm
Do the hostnames you have listed in your Corosync configuration resolve correctly? I would start by verifying that. # host isis.localdoaminSince, "domain", appears to be spelled incorrectly (or in a language I am ignorant of), I am going to guess that command fails? ;-) Also, you could use the short hostname (without ".localdomain") or the IP addresses of the interfaces you'd like Corosync to bind to instead.
I am having an error starting corosync on a cluster member: May 16 00:53:32 neftis corosync[19741]: [MAIN ] Corosync Cluster Engine ('2.3.4'): started and ready to provide service. May 16 00:53:32 neftis corosync[19741]: [MAIN ] Corosync built-in features: dbus systemd xmlconf snmp pie relro bindnow May 16 00:53:32 neftis corosync[19741]: [MAIN ] parse error in config: No interfaces defined May 16 00:53:32 neftis corosync[19741]: [MAIN ] Corosync Cluster Engine exiting with status 8 at main.c:1278. May 16 00:53:32 neftis corosync: Starting Corosync Cluster Engine (corosync): [FALL�] May 16 00:53:32 neftis systemd: corosync.service: control process exited, code=exited status=1 May 16 00:53:32 neftis systemd: Failed to start Corosync Cluster Engine. May 16 00:53:32 neftis systemd: Unit corosync.service entered failed state. May 16 00:53:32 neftis systemd: corosync.service failed. May 16 00:54:06 neftis systemd: Cannot add dependency job for unit firewalld.service, ignoring: Unit firewalld.service is masked. May 16 00:54:06 neftis systemd: Starting Corosync Cluster Engine... May 16 00:54:06 neftis corosync[19773]: [MAIN ] Corosync Cluster Engine ('2.3.4'): started and ready to provide service. May 16 00:54:06 neftis corosync[19773]: [MAIN ] Corosync built-in features: dbus systemd xmlconf snmp pie relro bindnow May 16 00:54:06 neftis corosync[19773]: [MAIN ] parse error in config: No interfaces defined May 16 00:54:06 neftis corosync[19773]: [MAIN ] Corosync Cluster Engine exiting with status 8 at main.c:1278. May 16 00:54:06 neftis corosync: Starting Corosync Cluster Engine (corosync): [FALL�] May 16 00:54:06 neftis systemd: corosync.service: control process exited, code=exited status=1 May 16 00:54:06 neftis systemd: Failed to start Corosync Cluster Engine. May 16 00:54:06 neftis systemd: Unit corosync.service entered failed state.Here is my config on the three nodes but it is failing just in netfis which I added recently. totem { version: 2 secauth: off cluster_name: cluster-osiris transport: udpu }nodelist { node { ring0_addr: isis.localdoamin nodeid: 1 } node { ring0_addr: horus.localdoamin nodeid: 2 } node { ring0_addr: netfis.localdoamin nodeid: 3 } }quorum { provider: corosync_votequorum }logging { to_syslog: yes }I am running a pacemaker, corosync, pcs cluster on CentOS 7.1 64. bits. I searched on internet but It is not clear what is going on. Could you help me?
Corosync error "No interfaces defined" in a cluster member
The guide doesn’t have you add nic=eno### to this command, but it failed for me if I didn’t use it. You can find your device number via the following command cat /etc/sysconfig/network-scripts/ifcfg-e* | grep DEVICEMine is eno16777984 so this is my example command. pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.1.218 cidr_netmask=32 nic=eno16777984 op monitor interval=30sMake sure it started using the following command: pcs cluster start --all && sudo pcs status resources
Ok so I have gotten fairly far into the configuration successfully, the two nodes have authenticated each other and all is well, but when I try to add the virtual_ip it never starts. What i've used so far is not really relevant, but my write up (wip) is here, i just don't want to make this post look larger then it needs to be. To create the virtual interface I have the used the following : pcs resource create virtual_ip ocf:heartbeat:IPaddr2 ip=192.168.1.218 cidr_netmask=32 op monitor interval=30sI only have one nic and its config looks like this : [root@node1 network-scripts]# cat ifcfg-eno16777984 TYPE="Ethernet" BOOTPROTO=none DEFROUTE="yes" IPV4_FAILURE_FATAL="no" IPV6INIT=no IPV6_AUTOCONF="yes" IPV6_DEFROUTE="yes" IPV6_PEERDNS="yes" IPV6_PEERROUTES="yes" IPV6_FAILURE_FATAL="no" NAME=eth0 UUID="bf0b3de8-f607-42f3-9b00-f22f59292c94" DEVICE="eno16777984" ONBOOT="yes" IPADDR=192.168.1.216 PREFIX=32 GATEWAY=192.168.1.1 DNS1=192.168.1.149The Error: (found via "pcs status") * virtual_ip_start_0 on node1 'unknown error' (1): call=12, status=complete, exitreason='Unable to find nic or netmask.', last-rc-change='Fri Apr 29 02:03:57 2016', queued=1ms, exec=24msI don't think its an IPTables problem, as I have it disabled currently along with all other Firewalls. I don't have SELinux disabled. I suspect I need another network config, but im a bit lost what to make the device= and really I am just moving from Ubuntu, so the layout is a bit new, but I love NMTUI! This looked promising regarding the interface, but I couldn't get it to work and I tried A LOT. Any help is appreciated. A few other reads I went thru https://www.centos.org/forums/viewtopic.php?t=50183 https://ihazem.wordpress.com/2011/03/15/adding-virtual-interface-to-centosredhat/ This is the guide I am following : http://clusterlabs.org/doc/en-US/Pacemaker/1.1-pcs/html-single/Clusters_from_Scratch/index.html#_add_a_resource As always, if you need more info, I am happy to provide it, thanks in advance!
Trouble Creating Virtual_IP for PaceMaker + Corosync - CentOS 7
I had a similar issue with an IAX2 trunk in a Pacemaker HA setup. The solution is not to disable the primary IP address of the NIC, but rather to source all traffic from the virtual IP address. There is even a pacemaker resource agent just for this. The ocf:heartbeat:IPsrcaddr. For example I have a virtual (secondary) IP of 192.168.5.4. This IP floats between nodes A & B. Nodes A & B have IP addresses of 192.168.5.2 and 192.168.5.3 respectively. The gateway for this network is at 192.168.5.1. I want all traffic to appear as if it coming from the virtual IP address of 192.168.5.4 which currently is hosted by nodeA. To do so we can simply add a default route with a specific source address set. ip route add default via 192.168.5.1 src 192.168.5.4You may then want to delete the old default route. You can try this to test initially and see if it resolves your issues. If that works for you then simply configure the ocf:heartbeat:IPsrcaddr resource agent in your pacemaker cib to set this default source route automatically should the virtual 192.168.5.4 address ever failover. In my cib I have it like so: primitive asterisk_srcaddr IPsrcaddr \ params ipaddress=192.168.5.4 cidr_netmask=24Just make certain that this asterisk_srcaddr resource starts after the 192.168.5.4 IPaddr2 resource.
I am having trouble setting up a Virtual/Floating IP. In this specific circumstance I am using Pacemaker+Corosync to manage 2 Virtual IP's. One is internal and the other is external to our SIP Trunk. VOIP Asterisk/FreePBX. The issue seems to be that our SIP Trunk is seeing the packets coming from the IP that is registered directly onto the NIC, not from the Virtual_IP that is tied to the NIC. Is this possible? Any thoughts on how to troubleshoot/fix this? Cluster Virtual IP Commands used to create Virtual IP's : pcs resource create www_virtual_ip ocf:heartbeat:IPaddr2 ip=10.1.8.32 cidr_netmask=32 nic=eth0 op monitor interval=30s pcs resource create sip_virtual_ip ocf:heartbeat:IPaddr2 ip=10.251.0.52 cidr_netmask=32 nic=eth1 op monitoI am using Asterisk 11 + FreePBX 2.12 on CentOS 7. I read this might be an asterisk 11 issue with the 2 IP's on one nic, but vs try to configure Asterisk, I'd like to get this working at the PaceMaker level.
IP Source Address issues with PaceMaker Virtual IP
That is definitely an interesting use case, thanks for sharing... While you're VIPs are getting DDoS'd they probably can't ping out reliably. Perhaps you might take a look at the 'ping' resource-agent for Pacemaker. The clusterlabs documentation mention it briefly here: http://clusterlabs.org/doc/en-US/Pacemaker/1.0/html/Pacemaker_Explained/ch09s03s03.html More information can be found by checking out the resource-agent's info via your preferred cluster configuration management tool: # crm ra info ping --or-- # pcs resource describe pingHope that is helpful.
I have a configuration with 5 nodes, 4 able to host resources and 1 resource. What I want to do is to make the resource stop completely after migrating N times from node to node. So a sample scenario would be: resource VIP1 running on node one; its monitor fails, migration-threshold is reached, it moves to node two; then it fails there again, and moves to node three; and then it fails again, but some kind of rule (that I'm searching for) prevents it to migrate to node four. I need some kind of migration counter, I guess. This is a test configuration, in reality I'll have more nodes and more resources. So I'd like the configuration be as simple as possible. I figure that I can achieve this using an opt-in or opt-out location preferrance strategy for each resource, but it's neither simple nor maintainable easily. Is there a better way? P.S. With current configuration, if I flood my VIP with hping, it will cycle through all nodes before it stops completely (because it has no more nodes to run on, until I cleanup it or introduce a failure-timeout option) Versions: [~] corosync -v Corosync Cluster Engine, version '2.3.6' Copyright (c) 2006-2009 Red Hat, Inc. [~] crm --version crm 2.2.0 [~] cat /etc/debian_version 8.5Pacemaker configuration: [~] crm configure show node 1: one node 2: two node 3: three node 4: arbitr \ attributes standby=on node 5: four primitive VIP1 IPaddr2 \ params ip=10.10.11.230 cidr_netmask=22 \ op monitor interval=1s timeout=40ms \ meta migration-threshold=1 target-role=Started location preferOne VIP1 50: one property cib-bootstrap-options: \ dc-version=1.1.14-70404b0 \ cluster-infrastructure=corosync \ cluster-name=debian \ stonith-enabled=false \ last-lrm-refresh=1474984960 \ have-watchdog=falseEDIT: The context and the story of the whole configuration is this: we have two load balancers with LVS that proxy traffic to our frontends. High-availability used to be achieved with a simple keepalived configuration and 2 VIPs (an active-active configuration; in a normal situation, each LVS has 1 VIP). But some guys lately started to DDoS us regularly, and the keepalived setup no longer works as expected: even if they DDoS only only 1 VIP, i.e. 1 host, its keepalived loses inbound traffic from another host, grabs the second VIP and cripples the whole system. So we thought that we a) find something to manage VIPs with quorum, to avoid split-brains; b) at least double the LVS hosts. So I tested pacemaker+corosync, and its configuration is really simple when we have two active and one standby nodes. Just as expected, when one of the VIP is DDoSed, that VIP first migrates to another node, and then shuts down completely. As we add nodes, that 'resource walk' becomes longer, which is not quite what we want: we want the VIP to be shut down as soon as possible, but also we of course want to leave a chance to automatically recover from an inner hardware problem (if the node suddenly goes down, FE). So I thought... maybe there's a way to migrate a resource just ONCE, and if still fails, then be done with it. Saves us from hardware failures; saves us time when we're under partial DDoS. That's pretty much it, sorry if it is too elaborate. If we chose the wrong instrument to deal with this from the start, please let me know. (Of course, we do defend from DDoS with other methods, but if the attack manages to get through, we want to minimize the damage).
Pacemaker: stopping resource after it migrate N times due to failover
Groups imply both ordering and location. So your group is saying, "start mysql, then mount the filesystem, then start the VIP". Not only is this incorrect ordering, but it is contradicting your ordering constraints. You should just put everything in the group besides DRBD, and then place a single ordering and single colocation constraint that ties the group to where DRBD is Master. The order in which you add constraints to the cluster has absolutely no affect on the outcome. Based on what you had up there, it would look something like this: # pcs -f clust_cfg resource create mysql_data01 ocf:linbit:drbd \ drbd_resource=mysql01 op monitor interval=30s # pcs -f clust_cfg resource master MySQLClone01 mysql_data01 \ master-max=1 master-node-max=1 clone-max=2 clone-node-max=1 \ notify=true # pcs -f clust_cfg resource create mysql_fs01 Filesystem \ device="/dev/drbd0" directory="/var/lib/mysql" fstype="ext4" # pcs -f clust_cfg resource create mysql_service01 ocf:heartbeat:mysql \ binary="/usr/bin/mysqld_safe" config="/etc/my.cnf" \ datadir="/var/lib/mysql" pid="/var/lib/mysql/mysql.pid" \ socket="/var/lib/mysql/mysql.sock" \ additional_parameters="--bind-address=0.0.0.0" \ op start timeout=60s op stop timeout=60s \ op monitor interval=20s timeout=30s # pcs -f clust_cfg resource create mysql_VIP01 ocf:heartbeat:IPaddr2 \ ip=192.168.1.215 cidr_netmask=32 nic=eth0 op monitor interval=30s # pcs -f clust_cfg resource group add SQL-Group mysql_fs01 \ mysql_service01 mysql_VIP01 # pcs -f clust_cf constraint order promote MySQLClone01 \ then start SQL-Group # pcs -f clust_cfg constraint colocation add SQL-Group with MySQLClone01 INFINITY with-rsc-role=Master # pcs cluster cib-push clust_cfg
I get this Error after finishing configuring cluster. And after trying to fail-BACK from node2 mysql_service01_monitor_20000 on node1 'not running' (7): call=20, status=complete, exitreason='none'shutdown cluster & restart mariadb pcs cluster stop --allservice mariadb restartservice mariadb stoppcs cluster start --allEverything comes online. pcs cluster standby node1Fails over to node2. But I get this error again... mysql_service01_monitor_20000 on node1 'not running' (7): call=77, status=complete, exitreason='none'Try to Failback to node1 pcs cluster unstandby node1 pcs cluster standby node2Doesn't fail back over and brings up the following: Failed Actions: * mysql_service01_monitor_20000 on node2 'not running' (7): call=141, status=complete, exitreason='none', last-rc-change='Mon Jun 13 20:33:36 2016', queued=0ms, exec=43ms * mysql_service01_monitor_20000 on node1 'not running' (7): call=77, status=complete, exitreason='none', last-rc-change='Mon Jun 13 20:31:23 2016', queued=0ms, exec=42ms * mysql_fs01_start_0 on node1 'unknown error' (1): call=113, status=complete, exitreason='Couldn't mount filesystem /dev/drbd0 on /var/lib/mysql', last-rc-change='Mon Jun 13 20:33:47 2016', queued=0ms, exec=53msAfter shutting down cluster and restarting MariaDB again on both nodes I get this up starting up again. mysql_service01 (ocf::heartbeat:mysql): FAILED node1After a full pcs cluster stop --all (successfull) and reboot and pcs cluster start --all. Everything works! It's sort of haphazard, but it really is HA, and I have e-mail notification of fail-over setup, so hopefully we could finish the day on backup, shutdown and restart services back on node1. But I would love to know whats going on, and how to stop this, it will sure make the demo to my boss's look bad. My Configs : Disable Firewall/SELinux sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/selinux/config systemctl disable firewalld.service systemctl stop firewalld.service iptables --flush rebootInstall PaceMaker + Corosync (CentOS 7) hostnamectl set-hostname $(uname -n | sed s/\\..*//) yum install -y pcs policycoreutils-python psmisc echo "passwd" | passwd hacluster --stdin systemctl start pcsd.service systemctl enable pcsd.serviceAuthorize on Node1 pcs cluster auth node1 node2 -u hacluster -p passwd pcs cluster setup --force --name mysql_cluster node1 node2 pcs cluster start --all pcs status | grep UNCLEANInstall DRBD/MariaDB : rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-2.el7.elrepo.noarch.rpm yum install -y kmod-drbd84 drbd84-utils mariadb-server mariadb systemctl disable mariadb.servicecat << EOL > /etc/my.cnf [mysqld] symbolic-links=0 bind_address = 0.0.0.0 datadir = /var/lib/mysql pid_file = /var/run/mariadb/mysqld.pid socket = /var/run/mariadb/mysqld.sock[mysqld_safe] bind_address = 0.0.0.0 datadir = /var/lib/mysql pid_file = /var/run/mariadb/mysqld.pid socket = /var/run/mariadb/mysqld.sock!includedir /etc/my.cnf.d EOLDrbd Res : cat << EOL >/etc/drbd.d/mysql01.res resource mysql01 { protocol C; meta-disk internal; device /dev/drbd0; disk /dev/sdb1; handlers { split-brain "/usr/lib/drbd/notify-split-brain.sh root"; } net { allow-two-primaries no; after-sb-0pri discard-zero-changes; after-sb-1pri discard-secondary; after-sb-2pri disconnect; rr-conflict disconnect; } disk { on-io-error detach; } syncer { verify-alg sha1; } on node1 { address 192.168.1.216:7788; } on node2 { address 192.168.1.220:7788; } } EOLfdisk /dev/sdbdrbdadm create-md mysql01 modprobe drbd drbdadm up mysql01drbdadm -- --overwrite-data-of-peer primary mysql01 drbdadm primary --force mysql01 watch cat /proc/drbd mkfs.ext4 /dev/drbd0 mount /dev/drbd0 /mnt df -h | grep drbd umount /mnt mount /dev/drbd0 /mnt # I Always get IO Errors so I just drbdadm up mysql01 # Both nodes watch cat /proc/drbd mount /dev/drbd0 /mnt df -h | grep drbd systemctl start mariadb mysql_install_db --datadir=/mnt --user=mysql umount /mnt systemctl stop mariadbPaceMaker Corosync Config : pcs -f clust_cfg resource create mysql_data01 ocf:linbit:drbd \ drbd_resource=mysql01 \ op monitor interval=30s pcs -f clust_cfg resource master MySQLClone01 mysql_data01 \ master-max=1 master-node-max=1 \ clone-max=2 clone-node-max=1 \ notify=true pcs -f clust_cfg resource create mysql_fs01 Filesystem \ device="/dev/drbd0" \ directory="/var/lib/mysql" \ fstype="ext4" pcs -f clust_cfg resource create mysql_service01 ocf:heartbeat:mysql \ binary="/usr/bin/mysqld_safe" \ config="/etc/my.cnf" \ datadir="/var/lib/mysql" \ pid="/var/lib/mysql/mysql.pid" \ socket="/var/lib/mysql/mysql.sock" \ additional_parameters="--bind-address=0.0.0.0" \ op start timeout=60s \ op stop timeout=60s \ op monitor interval=20s timeout=30s pcs -f clust_cfg resource create mysql_VIP01 ocf:heartbeat:IPaddr2 \ ip=192.168.1.215 cidr_netmask=32 nic=eth0 \ op monitor interval=30s pcs -f clust_cfg constraint colocation add mysql_service01 with mysql_fs01 INFINITY pcs -f clust_cfg constraint colocation add mysql_VIP01 with mysql_service01 INFINITY pcs -f clust_cfg constraint colocation add mysql_fs01 with MySQLClone01 INFINITY with-rsc-role=Master pcs -f clust_cfg constraint order mysql_service01 then mysql_VIP01 pcs -f clust_cfg constraint location mysql_fs01 prefers node1=50 pcs -f clust_cfg property set stonith-enabled=false pcs -f clust_cfg property set no-quorum-policy=ignore pcs -f clust_cfg resource defaults resource-stickiness=200 pcs -f clust_cfg resource group add SQL-Group mysql_service01 mysql_fs01 mysql_VIP01 pcs cluster cib-push clust_cfg pcs statusUpdate to Comment : Would this suffice, I assume I want the Clone before the FS and the FS before the Service. Also, with my Apache configs, which I am copying from, I have the VIP start before the webserver, but in the guide I am following for SQL, it has the VIP start first. Any thoughts? pcs -f clust_cf constraint order promote MySQLClone01 then start mysql_fs01 pcs -f clust_cf constraint order mysql_fs01 then mysql_service01I Will test and get back if it fixed it! Thanks This seems to have fixed the problem, fail-over happens as it should, but I still get the error, but like I said, its working good! Don't like seeing errors, but fail-over time is like 2 seconds. pcs constraint order promote MySQLClone01 then start mysql_fs01 pcs constraint order mysql_service01 then mysql_fs01
MySQL Server monitor_20000 on node1 'not running' - HA Cluster - Pacemaker - Corosync - DRBD
After downgrade to "corosync 2.4.2-1" problem solved. Why you guys vote "-" for the topic? It was so clear and like you see it was corosync's fault or the arch builder. What ever if you living the problem just downgrade and save your time.
I upgraded my servers. Then I started corosync service one by one on my servers. I started first on 3 server and I wait 5 min. Then I started next 4 corosync on other servers and 7 server crashed in same time. I'm using corosync since 5 years. I was using; Kernel: 4.14.32-1-lts Corosync 2.4.2-1 Pacemaker 1.1.18-1and I never saw this before. I guess something is broken in new corosync version really really bad! Kernel: 4.14.70-1-lts Corosync 2.4.4-3 Pacemaker 2.0.0-1- This is my corosync.conf: https://paste.ubuntu.com/p/7KCq8pHKn3/ Can you tell me how can I find the reason of the problem? Sep 25 08:56:03 SRV-2 corosync[29089]: [TOTEM ] A new membership (10.10.112.10:56) was formed. Members joined: 7 Sep 25 08:56:03 SRV-2 corosync[29089]: [VOTEQ ] Waiting for all cluster members. Current votes: 7 expected_votes: 28 Sep 25 08:56:03 SRV-2 corosync[29089]: [VOTEQ ] Waiting for all cluster members. Current votes: 7 expected_votes: 28 Sep 25 08:56:03 SRV-2 corosync[29089]: [VOTEQ ] Waiting for all cluster members. Current votes: 7 expected_votes: 28 Sep 25 08:56:03 SRV-2 corosync[29089]: [VOTEQ ] Waiting for all cluster members. Current votes: 7 expected_votes: 28 Sep 25 08:56:03 SRV-2 corosync[29089]: [QUORUM] Members[7]: 1 2 3 4 5 6 7 Sep 25 08:56:03 SRV-2 corosync[29089]: [MAIN ] Completed service synchronization, ready to provide service. Sep 25 08:56:03 SRV-2 corosync[29089]: [VOTEQ ] Waiting for all cluster members. Current votes: 7 expected_votes: 28 Sep 25 08:56:03 SRV-2 systemd[1]: Created slice system-systemd\x2dcoredump.slice. Sep 25 08:56:03 SRV-2 systemd[1]: Started Process Core Dump (PID 43798/UID 0). Sep 25 08:56:03 SRV-2 systemd[1]: corosync.service: Main process exited, code=dumped, status=11/SEGV Sep 25 08:56:03 SRV-2 systemd[1]: corosync.service: Failed with result 'core-dump'. Sep 25 08:56:03 SRV-2 kernel: watchdog: watchdog0: watchdog did not stop! Sep 25 08:56:03 SRV-2 systemd-coredump[43799]: Process 29089 (corosync) of user 0 dumped core. Stack trace of thread 29089: #0 0x0000000000000000 n/a (n/a) Write failed: Broken pipecoredumpctl info PID: 23658 (corosync) UID: 0 (root) GID: 0 (root) Signal: 11 (SEGV) Timestamp: Mon 2018-09-24 09:50:58 +03 (1 day 3h ago) Command Line: corosync Executable: /usr/bin/corosync Control Group: /system.slice/corosync.service Unit: corosync.service Slice: system.slice Boot ID: 79d67a83f83c4804be6ded8e6bd5f54d Machine ID: 9b1ca27d3f4746c6bcfcdb93b83f3d45 Hostname: SRV-1 Storage: /var/lib/systemd/coredump/core.corosync.0.79d67a83f83c4804be6ded8e6bd5f54d.23658.153777185> Message: Process 23658 (corosync) of user 0 dumped core. Stack trace of thread 23658: #0 0x0000000000000000 n/a (n/a) PID: 5164 (corosync) UID: 0 (root) GID: 0 (root) Signal: 11 (SEGV) Timestamp: Tue 2018-09-25 08:56:03 +03 (4h 9min ago) Command Line: corosync Executable: /usr/bin/corosync Control Group: /system.slice/corosync.service Unit: corosync.service Slice: system.slice Boot ID: 2f49ec6cdcc144f0a8eb712bbfbd7203 Machine ID: 9b1ca27d3f4746c6bcfcdb93b83f3d45 Hostname: SRV-1 Storage: /var/lib/systemd/coredump/core.corosync.0.2f49ec6cdcc144f0a8eb712bbfbd7203.5164.1537854963> Message: Process 5164 (corosync) of user 0 dumped core. Stack trace of thread 5164: #0 0x0000000000000000 n/a (n/a)I cant find more log so I can't dig the problem.
When I start corosync all servers panics with core dumps
You're not using the drbdadm command correctly. It wants the resource name, where you're giving it a node name. Try this instead (from node1): drbdadm up clusterdb drbdadm primary --force clusterdbAs a side note, DRBD expects the hostnames in its config to be the same as uname -n.
I am getting the following error when trying to set the Primary node for DRBD. 'node1' not defined in your config (for this host).I know this is related to DNS/Hostname/Hosts and the config clusterdb.res. I know this because I originally got an error when trying to start clusterdb.res if node1 didn't resolve correctly. So what confuses me is that I can start the clusterdb.res if either use: I have used this command on the hosts hostnamectl set-hostname $(uname -n | sed s/\\..*//)To make the hostname resolve to node1 instead of node1.localdomain Or add node1.localdomain to the config, either works. But I have tried all combinations and can't seem to get this command to take : drbdadm primary --force node1 && cat /proc/drbdMy Configs /etc/drbd.d/clusterdb.res resource clusterdb{ protocol C; meta-disk internal; device /dev/drbd0;startup { wfc-timeout 30; outdated-wfc-timeout 20; degr-wfc-timeout 30; }net { cram-hmac-alg sha1; shared-secret sync_disk; }syncer { rate 10M; al-extents 257; on-no-data-accessible io-error; verify-alg sha1; } on node1 { disk /dev/sda3; address 192.168.1.216:7788; } on node2 { disk /dev/sda3; address 192.168.1.217:7788; } }/etc/hosts : 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 192.168.1.216 node1 192.168.1.217 node2/etc/hostname node#My full write up ATM (wip) Edits : [root@node1 ~]# hostname node1 [root@node1 ~]# cat /etc/hosts 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 127.0.1.1 node1 192.168.1.216 node1 192.168.1.217 node2 [root@node1 ~]#Update: I have gotten this to work with LVM following this guide exactly, so I think my issue actually lies with the following lines of code. But for now I think i will stick with LVM since it works, unless somebody else really wants to work on this. (My working LVM writeup) device /dev/drbd0;or device /dev/drbd0; The reason I say this, is I used the same hosts/hostname/shortname/ip_addr but LVM and it worked, but maybe I missed something the first time, I fixed in my new VM Template (I started from scratch to build LVM)
DRBD - 'node1' not defined in your config (for this host) - Error when setting Primary
My guess would be that your shell/init script is not returning the proper return codes. In order for pacemaker to play nicely with an init script that init script needs to be fully LSB compliant. Run the init script though the compatibility checks here: http://www.linux-ha.org/wiki/LSB_Resource_Agents I suspect your script is returning a 0 on the status when it should not be.
I have a 2 node cluster on RHEL 6.9. Everything is configured except I'm having difficulty with an application launched via shell script that created into a service (in /etc/init.d/myApplication), which I'll just call "myApp". From that application, I did a pcs resource create myApp lsb:myApp op monitor interval=30s op start on-fail=standby. I am new to using this suite of software but it's for work. What I need is for this application to be launched on both nodes simultaneously as it has to be started manually so if the first node fails, it would need intervention if it were not already active on the passive node. I have two other services: -VirtIP (ocf:heartbeat:IPaddr2) for providing a service IP for the application server -Cron (lsb:crond) to synchronize the application files (we are not using shared storage) I have the VirtIP and Cron as dependents via colocation to myApp. I've tried master/slave as well as cloning but I must be missing something regarding their config. If I take the application offline, pacemaker does not detect the service has gone down and pcs status outputs that myApp is still running on the node (or nodes depending on my config). I'm also sometimes getting the issue that the service running the app is stopped by pacemaker on the passive node. Which is the way I need to configure this? I've gone through the RHEL documentation but I'm still stuck. How do I get pacemaker to initiate failover if myApp service goes down? I don't know why it's not detecting the service has stopped in some cases. EDIT: So for testing purposes, I removed the password requirement for starting/restarting and the service starts/restarts fine as expected and the colocation dependent resources stop/start as expected. But stopping the myApp service does not reflect as a stopped resource but simply stays at Started node1. Likewise, simulating a failover via putting node1 into standby simply stops all resources on node1.
RHEL High-Availability Cluster using pcs, configuring service as a resource
Your colocation constraint is incorrect. You're telling the cluster that DRBD must be Master where jenkins_group is started. Use the following constraints instead: colocation cl_jenkins-with-drbd inf: jenkins_group ms_drbd_jenkins:Master order o_drbd-before-jenkins inf: ms_drbd_jenkins:promote jenkins_group:startPro-tip: Notice the "language" in the constraint names: cl____-with-____, o____-before-____. That matches the resource names the follow the inf: scoring. If you follow the with and before naming conventions in your constraint names, they become much easier to read/manage/troubleshoot.
node $id="10" db10 \ attributes standby="off" node $id="9" db09 \ attributes standby="off" primitive drbd_jenkins ocf:linbit:drbd \ params drbd_resource="r0" \ op start interval="0s" timeout="60s" \ op stop interval="0s" timeout="60s" primitive jenkins lsb:jenkins \ op monitor interval="15s" \ op start interval="0s" timeout="90s" primitive mount_jenkins ocf:heartbeat:Filesystem \ params device="/dev/drbd0" directory="/var/lib/jenkins/" fstype="ext4" \ op start timeout="20s" interval="0" \ op stop timeout="20s" interval="0" primitive vip-158 ocf:heartbeat:IPaddr2 \ params ip="x.x.x.158" nic="eth0" cidr_netmask="28" \ op start interval="0s" timeout="60s" \ op monitor interval="5s" timeout="20s" \ op stop interval="0s" timeout="60s" \ meta target-role="Started" group jenkins_group jenkins vip-158 mount_jenkins ms ms_drbd_jenkins drbd_jenkins \ meta master-max="1" master-node-max="1" clone-max="2" clone-node-max="1" notify="true" globally-unique="false" target-role="Master" colocation drbd_mount inf: ms_drbd_jenkins:Master jenkins_group order mount_after_drbd inf: ms_drbd_jenkins:promote jenkins_group:start property $id="cib-bootstrap-options" \ dc-version="1.1.10-42f2063" \ cluster-infrastructure="corosync" \ stonith-enabled="false" \ last-lrm-refresh="1489005751" rsc_defaults $id="rsc-options" \ resource-stickiness="0"When pacemaker starts, it's all fine: root@db09:~# crm status Last updated: Wed Mar 8 21:20:33 2017 Last change: Wed Mar 8 21:15:15 2017 via crm_resource on db10 Stack: corosync Current DC: db10 (10) - partition with quorum Version: 1.1.10-42f2063 2 Nodes configured 5 Resources configuredOnline: [ db09 db10 ]Master/Slave Set: ms_drbd_jenkins [drbd_jenkins] Masters: [ db09 ] Slaves: [ db10 ] Resource Group: jenkins_group jenkins (lsb:jenkins): Started db09 vip-158 (ocf::heartbeat:IPaddr2): Started db09 mount_jenkins (ocf::heartbeat:Filesystem): Started db09But I cant move master to db10, either with: crm_resource --resource ms_drbd_jenkins --move --node db10 or crm resource migrate ms_drbd_jenkins db10 The worst thing is if I set db09 node standby, both becomes slaves: root@db09:~# crm node standby db09 root@db09:~# crm status Last updated: Wed Mar 8 21:27:26 2017 Last change: Wed Mar 8 21:27:24 2017 via crm_attribute on db09 Stack: corosync Current DC: db10 (10) - partition with quorum Version: 1.1.10-42f2063 2 Nodes configured 5 Resources configuredNode db09 (9): standby Online: [ db10 ] Master/Slave Set: ms_drbd_jenkins [drbd_jenkins] Slaves: [ db09 db10 ]If db10 goes standby, it becomes stopped, which is expected: root@db09:~# crm node standby db10 root@db09:~# crm status Last updated: Wed Mar 8 21:28:45 2017 Last change: Wed Mar 8 21:28:44 2017 via crm_attribute on db09 Stack: corosync Current DC: db10 (10) - partition with quorum Version: 1.1.10-42f2063 2 Nodes configured 5 Resources configuredNode db10 (10): standby Online: [ db09 ] Master/Slave Set: ms_drbd_jenkins [drbd_jenkins] Masters: [ db09 ] Stopped: [ db10 ] Resource Group: jenkins_group jenkins (lsb:jenkins): Started db09 vip-158 (ocf::heartbeat:IPaddr2): Started db09 mount_jenkins (ocf::heartbeat:Filesystem): Started db09 What am I doing wrong here?
Pacemaker doesn't failover
Using a simple location constraint isn't enough for this task. Pacemaker rules can handle more advanced expressions needed for this. Depending on the RHEL/Pacemaker version one of these rules should work for you: # pcs constraint location <clone> rule role=promoted score=-INFINITY node eq <quorum-node-name># pcs constraint location <clone> rule role=master score=-INFINITY node eq <quorum-node-name>
I have a drbd + pacemaker cluster with three nodes, one being a quorum device only. I'm trying to configure the pacemaker resource so that the promotable drbd-resource should run on all three devices, but it should never be promoted on the quorum device. I've tried setting location constraints on the resource, but that results in pacemaker not starting the resource at all on the quorum device so drbd can't keep quorum on a failover. The desired state would be:drbd resource is started on all three nodes drbd resource is promotable pacemaker will never promote the quorum deviceI can't find anything in the documentation, but what I'm envisioning would be a parameter like "don't promote on device X" that I have missed for the drbd resource.
Prevent promotion on specific node in Pacemaker
DRBD should work for this. There are plenty of tutorials out there describing how to configure a Pacemaker, Corosync, and DRBD cluster stack. DRBD replicates an entire block device, so you'd either add an additional disk to your VMs, cut some extra space out of an LVM volume group for a new LV, or partition your disk.
I'm planning to use pacemaker with corosync and pcs to provide HA in a active-passive cluster for our two front end servers serving a perl application. I have configured resources for the service IP, Apache the application daemon and what I still need to do - configure replication. That means, I need to configure replication that depending which node is the active one it will sync the whole /opt/application directory to the passive node. How to achieve this is the bast way? Both frontends are ESX VM's. Thank you!
data sync in a active-passive pacemaker cluster
From the resources indentation it appears that the resource webfs is not in fact a member of the group myweb. You can verify this using pcs status groups. You can add the webfs resource to the myweb resource group using pcs resource group add myweb webfs PS: This is clearly a web server resource group, so you have to pay attention to the order in which the resources are added to this resource group, the correct order would in fact be :webfs mywebserver webip
According to redhat's official documentation, all resources in a resource group implicitly have colocation and order constraints. But from the tests i did in my lab setup i can't see any constraints and resources in the same resource groups are started on different nodes. [root@node1 conf]# pcs status Cluster name: mycluster Last updated: Thu Oct 26 03:49:50 2017 Last change: Wed Oct 25 11:01:51 2017 by root via crm_resource on node1 Stack: corosync Current DC: node1 (version 1.1.13-10.el7-44eb2dd) - partition with quorum 3 nodes and 6 resources configuredOnline: [ node1 node2 node3 ]Full list of resources: fencer_node3 (stonith:fence_xvm): Started node1 fencer_node1 (stonith:fence_xvm): Started node2 fencer_node2 (stonith:fence_xvm): Started node3 Resource Group: myweb webip (ocf::heartbeat:IPaddr2): Started node1 mywebserver (ocf::heartbeat:apache): Started node1 webfs (ocf::heartbeat:Filesystem): Started node2PCSD Status: node1: Online node3: Online node2: OnlineDaemon Status: corosync: active/enabled pacemaker: active/enabled pcsd: active/enabled
Are there implicit constraints for resource groups in a pacemaker cluster?
You can give the named resource agent a user via 'named_user', and you can pass other options via 'named_options': pcs resource create NameService named named_user=named \ named_options="-t /var/chroot" op monitor interval=30s Or you could try using the "anything" resource agent to feed options to named. It would look something like this: pcs resource create NameService ocf:heartbeat:anything \ binfile="/usr/sbin/named" cmdline_options="-u named -t /var/chroot" \ pidfile="/var/run/named.pid" op monitor interval=30s EDIT: For more resource agent options: # pcs resource describe ocf:heartbeat:named
A simple and fast question about pcs. With this command pcs resource create NameService named op monitor interval=30sI create a resource named,wich is working,but if i want to run named -u named -t /var/chroot instead of default named,how to create a resource with those options?
PCS and corosync/pacemaker
I solved it in the way "I don't care any more": I created an extra copy of the configurations that I edit any sync in /etc/xen/vm/. As the cluster RA VirtualDomain creates the VM newly from the configuration file given, I just specify that copy, and so I don't have to care any more where libvirt stores the actual VM configuration.
Migrating from Xen's xm to Xen's xl under control of libvirt, I wonder: Where does libvirt store the "originals" of VM configurations? I found that my PVM configurations are stored in /etc/libvirt/libxl/, but when viewing such files I see a comment saying that file has been created automatically and I should not be edited ("use virsh edit ..."). I also found XML and JSON files in /var/lib/xen, named after the Domain ID and UUID of the VM. As I'm configuring a HA cluster, I'd like to synchronize VM configurations across all cluster nodes (allowing live-migration). In the past syncing /etc/xen/vm was enough, but for libvirt it seems to be much more complicated: Sometimes I'll have to virsh define a VM from the XML file, virsh destroy does not only destroy the running VM, but also the configuration it seems, and virsh undefine also removed the XML file in /etc/libvirt/libxl/ it seems. I don't know how to synchronize the configuration across the cluster nodes. The major problem I see is this: After csync2-ing the XML files defining the VM configurations to the other cluster nodes, I see the changes in the /etc/libvirt/libxl/ files, saying "do not edit; use virsh edit instead". However when I use virsh edit for one of those files, the contents I see in the editor is not what I see in the XML files located in /etc/libvirt/libxl/. Maybe re-phrase the question to: If I update the XML files in /etc/libvirt/libxl/ (like via csync2), how can I ensure that libvirt uses the updated configurations? Update This question became more important after I had added a block device for paging using xl block-attach corresponding to the edited configuration. When the VM was live-migrated to another node in the cluster, the added disk was not transferred to the VM, so the VM froze when trying to access that disk. So obviously the configuration of the current machine was not used for live-migration, and the saved configuration in the XML files weren't used either.
Where are libvirt's VM definitions "originals" stored, and how to sync them across multiple nodes?
Found an issue with the ppp/peers/provider file Removing updetach from the provider file fixed it. updetach With this option, pppd will detach from its controlling terminal once it has successfully established the ppp connection (to the point where the first network control protocol, usually the IP control protocol, has come up). Can anyone explain why this fixed my problem :)? Solved it but not 100% sure why this worked.
Trying to automate making a ppp connection on boot. I have a cell modem (skywire LE910 SVG) that I have working manually using pon. My ppp/peers/isp is configured and the corresponding chatscript is working. After my device boots (beaglebone black running 3.8.13 Debian wheezy) I can run pon verizon (name of isp) and then see my established ppp0 via ifconfig. How do I make this happen on boot?
Establish a PPP connection on boot
I guess the problem is a bug specific to pppd version 2.4.5, which is the one that comes with Debian 7. I tested versions 2.4.4 and 2.4.6 (which is the latest as of now) on the same and other machines and they work as expected. pppd package seems to have a lot of signal handler manipulation code in it, which I guess could lead to these kind of bugs. I'm just happy that it's been fixed by now.
I'm trying to connect to GPRS network through a serial port connected GSM modem. When I call /usr/sbin/pppd call <peer_name> from the command line, it correctly receives and handles Ctrl+C from keyboard. But when I put the exact same command in an empty shell script (with or without the shebang #! at the top), chmod +x it and run it from the shell prompt, then pppd starts to run - But it totally ignores Ctrl+C key combination. Ctrl+Z works normally though. This is the contents of the pppd peer file nodetach dump connect "connect_script" disconnect "disconnect_script" /dev/ttyS0 noauthI tested another peer file which I had created to connect to a PPTP VPN server - with the same result. PPTP does not need a chat script, so I'm ruling out problems with chat command or serial port link properties. OS is debian 7. Any ideas what is happening here?
Ctrl-C is ignored by pppd when put in a shell script
Note: I will consider that your router's LAN is 192.0.2.0/24 and its LAN IP on eth0 is 192.0.2.1/24, to be able to give concrete explanations and a solution. Your ISP, to spare some public IP addresses, assigned you a private IPs for internal routing purpose. That's fine because this IP is never meant to be seen outside (and would be quickly dropped by Strict Reverse Path Forwarding along the path if ever put on the wire beyond your ISP router, or if not, since non-routable, will never get a reply). But this makes your configuration more complex to avoid having this IP to be used in all cases but connectivity to ISP, from your router. You probably have something similar to this (it might be slightly different, doesn't matter): # ip route default via 10.0.0.9 dev ppp0 10.0.0.9 dev ppp0 proto kernel scope link src 10.0.0.10 192.0.2.0/24 dev eth0 proto kernel scope link src 192.0.2.1 It's possible for example that you have instead default via 10.0.0.9 dev ppp0 src 10.0.0.10 , or that via 10.0.0.9 doesn't even appear, since it's a layer 3 link rather than a layer 2 link, making via not needed (but still accepted). Just adapt the settings below accordingly. Currently, the kernel chooses the apparently best suited IP, the one set on the same side to reach Internet, since nothing tells it otherwise (or it explicitly tells to use the IP you don't want): # ip route get 8.8.8.8 8.8.8.8 via 10.0.0.9 dev ppp0 src 10.0.0.10 uid 0 cache You just need to replace the routing behaviour when the kernel checks how to reach internet and state a specific preferred source IP address. Be aware that you might lose connectivity in case of errors and unforeseen problems. Have alternate (console) access if possible: # ip route replace default via 10.0.0.9 dev ppp0 src 192.0.2.1 # ip route get 8.8.8.8 8.8.8.8 via 10.0.0.9 dev ppp0 src 192.0.2.1 uid 0 cache That's it, your router will route as usual, but when needing to choose a locally originated outgoing IP, will select 192.0.2.1 unless explicitly told otherwise (eg: process binding explicitly the source IP on its socket). This route must be set again each time the link is brought down then up. It's up to you to integrate this in some pppoe script, after the link is fully established. Note also that the interface name ppp0 might change to ppp1 or any other name. That's up to you to deal with this in your setup scripts.Alternate methods to set this same route setting:add a lower metric, when a metric is initially set If the original metric was set (ie it wasn't 0, let's say it was 100), you can instead add an alternate default route with a lower metric rather than replacing the previous: # ip route add default via 10.0.0.9 dev ppp0 src 192.0.2.1 metric 50dedicated routing rule If you fear interaction from various tools involved in pppoe that might remove the route above, you can install this setting in an alternate routing table and give it precedence in routing rules, with a partial copy of the main table to prevent disruption. This will still have to be redone after each disconnection/reconnection, because the route will still disappear. Here iif lo is special and really means "locally originated outgoing packet" rather than incoming, and 109 is an arbitrary chosen table value: # ip rule add iif lo lookup 109 # needed only once # ip route add table 109 10.0.0.9 dev ppp0 proto kernel scope link src 10.0.0.10 # to keep using 10.0.0.10 for local link, just in case # ip route add table 109 192.0.2.0/24 dev eth0 src 192.0.2.1 # will disappear if eth0 is brought down # ip route add table 109 default via 10.0.0.9 dev ppp0 src 192.0.2.1 # will disappear if ppp0 is brought downIf you added other routing entries in the main table, chances are you'd also have to copy them above. # ip route get 8.8.8.8 8.8.8.8 via 10.0.0.9 dev ppp0 table 109 src 192.0.2.1 uid 0 cache routing rules with simplified route One can keep the routes in the main table and override only the default route with a prefix-based suppressor in the rule: This avoid having to copy all routes: one can just copy and change the default route. Replace 2. with (stating the preference values, still putting them in descending order as would happen without stating them): # ip rule add pref 32765 iif lo lookup 109 # needed only once # ip rule add pref 32764 iif lo lookup main suppress_prefixlength 0 # needed only once# ip rule 0: from all lookup local 32764: from all iif lo lookup main suppress_prefixlength 0 32765: from all iif lo lookup 109 32766: from all lookup main 32767: from all lookup default# ip route add table 109 default via 10.0.0.9 dev ppp0 src 192.0.2.1 # will disappear if ppp0 is brought downThe main routing table will be used first for anything that won't be the default route, then for locally originated outgoing traffic the default route is provided in routing table 109. Anything else will continue and lookup the main table again for the default route as usual. The advantage over 2. is that there's no need to duplicate (non-default) routes from table main into table 109 anymore. Below, table main provides the result for a non-default route, contrary to the 2. method: # ip route get 8.8.8.8 8.8.8.8 via 10.0.0.9 dev ppp0 table 109 src 192.0.2.1 uid 0 cache # ip route get 192.0.2.2 192.0.2.2 dev eth0 src 192.0.2.1 uid 0 cache
Background InformationI'm using a Linux system to route traffic for a small block of public IPv4 addresses (by enabling IP forwarding in sysctrl.conf).The router is connecting to the ISP over eth1 using PPPoE.The local peer address used for ppp is a manually-configured IP address that was specified by the ISP. The local peer address is 10.0.0.10.The remote peer address used for ppp is also a manually-configured IP address that was specified by the ISP. The remote peer address is 10.0.0.9.The router's default route is 10.0.0.9 via 10.0.0.10.The router is connected to an Ethernet switch via eth0. eth0 is configured to use one of the public addresses.The switch connects all other public hosts. Each connected host uses a public IP address. 10.0.0.9 ISP ----------+ | 10.0.0.10 X.X.X.X +------------- (eth1) ROUTER (eth0) --------------- SWTICH | +-- X.X.X.Y +-- X.X.X.Z ...My Problem Everything works as expected except for programs running on the router. Any application that I run on the router uses 10.0.0.10 as the source IP address when initiating connections to the internet. This is understandable since eth1 is where the internet is available. However, because the address is not publicly routable, apt, ping, and other programs don't work. If I explicitly set the source address on applications that support it (i.e. ping), applications do work. My Question How can I configure the router to route unknown packets via eth1/10.0.0.9 while also using the public IP address on eth0 as the default source when initiating new connections?
How to change the default source IP address to be something other than the address facing the default route?
Change the used loglevel in your NetworkManager.conf file[logging] This section controls NetworkManager's logging. Any settings here are overridden by the --log-level and --log-domains command-line options. level=<level> One of [ERR, WARN, INFO, DEBUG]. The ERR level logs only critical errors. WARN logs warnings that may reflect operation. INFO logs various informational messages that are useful for tracking state and operations. DEBUG enables verbose logging for debugging purposes. Subsequent levels also log all messages from earlier levels; thus setting the log level to INFO also logs error and warning messages.But note this part:This section controls NetworkManager's logging. Any settings here are overridden by the --log-level and --log-domains command-line options.
I'm running Arch Linux, and recently updated the whole system. Now I every time I connects to VPN with nmcli command, if it fails, I couldn't figure out the reason: NetworkManager[15967]: <info> VPN plugin state changed: starting (3) NetworkManager[15967]: <info> VPN connection 'XXX' (Connect) reply received. NetworkManager[15967]: <warn> /sys/devices/virtual/net/ppp0: couldn't determine device driver; ignoring... NetworkManager[15967]: <warn> VPN plugin failed: 1 NetworkManager[15967]: <warn> VPN plugin failed: 1 NetworkManager[15967]: <warn> VPN plugin failed: 1 NetworkManager[15967]: <info> VPN plugin state changed: stopped (6) NetworkManager[15967]: <info> VPN plugin state change reason: 0 NetworkManager[15967]: <warn> error disconnecting VPN: Could not process the request because no VPN connection was active.Prior to the upgrade, I can see error messages from pppd, e.g "You're already logged in bla bla", now every helpful message is gone. Any ideas? Why is the connection failed?
How do I know why NetworkManager failed to initiate the VPN connection?
Most probably /etc/ppp/ip-up.d is the location you are looking for. My example is valid on Gentoo Linux but the same directory structure seems to exist on Arch. Every time a VPN connection is made /etc/ppp/ip-up is run, which typically executes /etc/ppp/ip-up.d/* in turn. Its first argument is the attached pppn device. Put this script under /etc/ppp/ip-up.d/90-local for instance: #!/bin/sh# Optional trace: # logger -t "ppp" "$6: $1 (${2:--}, $3) $4 --> $5"iptables -A FORWARD -i $1 -o eth0 -j ACCEPT iptables -A FORWARD -i eth0 -o $1 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE You might as well use the environment variables pppd sets before running scripts. The one you are looking for is $DEVICE. Simply replace $1 with $DEVICE in the above script: iptables -A FORWARD -i $DEVICE -o eth0 -j ACCEPT iptables -A FORWARD -i eth0 -o $DEVICE -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE See man pppd for more info on what pppd does when establishing a connection.
I'm trying to setup a VPN over SSH using PPPD (following the Arch Wiki). The command given is: /usr/sbin/pppd updetach noauth silent nodeflate pty \ "/usr/bin/ssh root@remote-gw /usr/sbin/pppd nodetach notty noauth" \ ipparam vpn 10.0.8.1:10.0.8.2I have successfully managed to set it up with appropriate modifications to the above command. To connect to the internal network on the server side, I had to set up forwarding using iptables on the server side (blindly following this SF post): iptables -A FORWARD -i ppp0 -o eth0 -j ACCEPT iptables -A FORWARD -i eth0 -o ppp0 -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE I'd like to automate this. Now, eth0 is fixed, but the ppp0 may change (for example, someone else also has started a similar setup). How can I detect what interface was created by the pppd command on the server side? Parse dmesg? Diff the output of ip -o a? Can I get pppd to report it to me?Client is an up-to-date Arch Linux Server is an up-to-date Ubuntu 14.04dmesg seems to be useless: $ dmesg | grep -i ppp [ 0.803033] PPP generic driver version 2.4.2 [135747.442807] PPP BSD Compression module registered [135747.459013] PPP Deflate Compression module registeredNo mention of a device being created. syslog seems to be more useful: Apr 26 13:52:15 server pppd[12725]: pppd 2.4.5 started by muru, uid 0 Apr 26 13:52:15 server pppd[12725]: Using interface ppp0 Apr 26 13:52:15 server pppd[12725]: Connect: ppp0 <--> /dev/pts/7 Apr 26 13:52:15 server pppd[12725]: BSD-Compress (15) compression enabledThe Using interface ppp0 line seems to be what I want. I think I can get it thus: awk '/started by muru/{getline; pppdev=$NF} END {print pppdev}'Can I rely on the output of pppd for this?
How do I detect which device was recently created by pppd?
After a lot of work, we have a working config and CHAT script. I think the root cause is the lack of reception caused by a dodgy fly lead. AT+CSQWill return the reception and the confidence figure (Lower is better for both). In the original log, this was 99,99. With a different fly lead the following is returned. +CSQ: 15,99The final chat script that was used is: TIMEOUT 5 ECHO ON ABORT '\nBUSY\r' ABORT '\nERROR\r' ABORT '\nNO ANSWER\r' ABORT '\nNO CARRIER\r' ABORT '\nNO DIALTONE\r' ABORT '\nRINGING\r\n\r\nRINGING\r' '' 'ATZ' '' \rAT TIMEOUT 30 OK 'AT+CSQ' OK 'AT#SIMDET=1' OK 'AT+CGDCONT = 1,"IP","telstra.internet"' OK 'AT+CGDCONT?' \r \d\c 'OK' 'ATD*99#' \r \d\c \r \d\c 'CONNECT' ''The \r \d\c are a 1 second pause. As this is at boot and power up, being a bit slower is alright in this application. This probably can be optimised. The Peers script we are using is: # initialization string. connect "/usr/sbin/chat -v -f /etc/ppp/chat" # Serial device to which the modem is connected. /dev/ttyUSB2 # Speed of the serial line. 115200 # Assumes that your IP address is allocated dynamically by the ISP. noipdefault # Try to get the name server addresses from the ISP. usepeerdns #Use this connection as the default route. defaultroute replacedefaultroute # Makes pppd "dial again" when the connection is lost. persist # Do not ask the remote to authenticate. noauth # For testing purposes debug nodetachThis does work now so should be usable into the future.
We have a Telit LE910 connected to a Gumstix Overo SBC. The Overo is running Yocto Linux (Kernel 3.21) We have managed to get most things working but we now have an issue with the PPTP client. When we try to initialise the PPPd we get the following output: root@overo:~# pppd call telstra AT OK AT+CGDCONT=1,"IP","telstra.internet" OK ATH OK ATE1 OK AT+CSQ +CSQ: 99,99OK ATD*99***1# CONNECT Script /usr/sbin/chat -v -f /etc/ppp/chat finished (pid 3768), status = 0x0 Serial connection established. using channel 102 Using interface ppp0 Connect: ppp0 <--> /dev/ttyUSB2 sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x7be0adcd> <pcomp> <accomp>] rcvd [LCP ConfReq id=0xab <asyncmap 0x0> <auth chap MD5> <magic 0x909a1588> <pcomp> <accomp>] No auth is possible sent [LCP ConfRej id=0xab <auth chap MD5>] rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x7be0adcd> <pcomp> <accomp>] rcvd [LCP ConfReq id=0xac <asyncmap 0x0> <magic 0x909a1588> <pcomp> <accomp>] sent [LCP ConfAck id=0xac <asyncmap 0x0> <magic 0x909a1588> <pcomp> <accomp>] sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>] sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>] rcvd [LCP DiscReq id=0xad magic=0x909a1588] rcvd [LCP ProtRej id=0xae 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00] Protocol-Reject for 'Compression Control Protocol' (0x80fd) received rcvd [IPCP ConfNak id=0x1 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] sent [IPCP ConfReq id=0x2 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] rcvd [IPCP ConfNak id=0x2 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] sent [IPCP ConfReq id=0x3 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] rcvd [IPCP ConfNak id=0x3 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] sent [IPCP ConfReq id=0x4 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] rcvd [IPCP ConfNak id=0x4 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] sent [IPCP ConfReq id=0x5 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] rcvd [IPCP ConfNak id=0x5 <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>] sent [IPCP ConfReq id=0x6 <compress VJ 0f 01> <addr 0.0.0.0> <ms-dns1 10.11.12.13> <ms-dns2 10.11.12.14> <ms-wins 10.11.12.13> <ms-wins 10.11.12.14>]We did have this running on a development board, but despite using the same configuration, we haven't been able to get it working. Is there a configuration issue or is there something more fundamental going on?
PPPD on Yocto (Telit LE910 connecting to Telstra)
By some trial and error, I found following section in my /etc/ppp/options: # BSD licensed ppp-2.4.2 upstream with MPPE only, kernel module ppp_mppe.o # {{{ refuse-pap refuse-chap refuse-mschap # Require the peer to authenticate itself using MS-CHAPv2 [Microsoft # Challenge Handshake Authentication Protocol, Version 2] authentication. require-mschap-v2 # Require MPPE 128-bit encryption # (note that MPPE requires the use of MSCHAP-V2 during authentication) require-mppe-128 # }}}Commenting out all those refuse-* and require-* options made the authentication (and connection) succeed.
I tried to configure AnyDATA ADU890-WH modem to work in Linux, but I have not succeeded. I am client of Czech carrier O2 and using Ubuntu 14.04. I have once managed to connect using Network Center, Mobile Broadband tab - but since then I have not succeeded. This is my wvdial.conf: [Dialer Defaults] Init2 = ATQ0 V1 E1 &C1 &D2 +FCLASS=0 Modem Type = Analog Modem Phone = *99# Stupid Mode = 1 ISDN = 0 Username = a Init1 = ATZ Password = a Modem = /dev/ttyUSB0 Dial Command = ATDT Baud = 9600[Dialer CDMA] Auto DNS = 0 Init1 = ATQ Init2 = ATZ Stupid Mode = 1 Phone = #777 Idle Seconds = 0 Modem = /dev/ttyUSB0 Username = [emailprotected] Dial Command = ATDT Password = xxxxxx Baud = 1500000[Dialer three] Init2 = ATZ Init3 = ATQ0 V1 &D2 &C1 S0=0 +IFC=2,2 Init5 = AT+CGDCONT=1,"IP","internet" ISDN = 0 Modem = /dev/ttyUSB0 Modem Type = Analog ModemAnd this is important part of /var/log/syslog file: Jul 23 20:25:07 wigos-hp-lx pppd[5524]: pppd 2.4.5 started by root, uid 0 Jul 23 20:25:07 wigos-hp-lx pppd[5524]: Using interface ppp0 Jul 23 20:25:07 wigos-hp-lx pppd[5524]: Connect: ppp0 <--> /dev/ttyUSB0 Jul 23 20:25:07 wigos-hp-lx NetworkManager[740]: SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/ppp0, iface: ppp0) Jul 23 20:25:07 wigos-hp-lx NetworkManager[740]: SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/ppp0, iface: ppp0): no ifupdown configuration found. Jul 23 20:25:07 wigos-hp-lx NetworkManager[740]: <warn> /sys/devices/virtual/net/ppp0: couldn't determine device driver; ignoring... Jul 23 20:25:07 wigos-hp-lx pppd[5524]: MPPE required, but MS-CHAP[v2] nor EAP-TLS auth are performed. Jul 23 20:25:07 wigos-hp-lx pppd[5524]: Connection terminated. Jul 23 20:25:07 wigos-hp-lx NetworkManager[740]: SCPlugin-Ifupdown: devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0) Jul 23 20:25:07 wigos-hp-lx pppd[5524]: Exit.I have also found some guides how to set up the connection without wvdial - but these guides rely on starting the connection by pon <connection-name>, but when using this command, I get no output and nothing happens. The modem supports also CDMA network, but the error when using wvdial is the same.
wvdial: The PPP daemon has died: Pty program error (exit code = 9)
The answer turned out to be that there was a bug in version 2.4.7 of pppd for Linux. The solution was simply to upgrade to version 2.4.9 and I have successfully the 'client' to accept the interface identifier from the 'server'. Here is the debug output on the client: $ sudo pppd file ./ppp-options ipv6cp-accept-local /dev/ttyAMA0 115200 using channel 368 Using interface ppp0 Connect: ppp0 <--> /dev/ttyAMA0 sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0x7f793cbe>] rcvd [LCP ConfReq id=0xb <asyncmap 0x0> <magic 0xecde7250>] sent [LCP ConfAck id=0xb <asyncmap 0x0> <magic 0xecde7250>] rcvd [LCP ConfReq id=0xb <asyncmap 0x0> <magic 0xecde7250>] sent [LCP ConfAck id=0xb <asyncmap 0x0> <magic 0xecde7250>] rcvd [LCP ConfAck id=0x1 <asyncmap 0x0> <magic 0x7f793cbe>] sent [LCP EchoReq id=0x0 magic=0x7f793cbe] sent [IPV6CP ConfReq id=0x1 <addr fe80::0dfd:3c3b:e130:91ce>] rcvd [LCP EchoReq id=0x0 magic=0xecde7250] sent [LCP EchoRep id=0x0 magic=0x7f793cbe] rcvd [LCP EchoRep id=0x0 magic=0xecde7250] rcvd [IPV6CP ConfReq id=0xb <addr fe80::0000:0000:0000:0001>] sent [IPV6CP ConfAck id=0xb <addr fe80::0000:0000:0000:0001>] rcvd [IPV6CP ConfNak id=0x1 <addr fe80::0000:0000:0000:0002>] sent [IPV6CP ConfReq id=0x2 <addr fe80::0000:0000:0000:0002>] rcvd [IPV6CP ConfAck id=0x2 <addr fe80::0000:0000:0000:0002>] local LL address fe80::0000:0000:0000:0002 remote LL address fe80::0000:0000:0000:0001 Script /etc/ppp/ipv6-up started (pid 7049) Script /etc/ppp/ipv6-up finished (pid 7049), status = 0x0
I have two Raspberry Pis with their serial ports connected to each other. I have established a PPP link between the two of them and successfully ICMPV6 pinged and opened TCP sockets between them. But I can't work out how to get the 'client' pppd to accept the link-local IPv6 address provided by the 'server' pppd. I am trying to use static addresses so I know the link-local IP address of the remote peer. On the 'server' I am running: pppd file ./ppp-options ipv6 ::1,::2 /dev/ttyAMA0 115200And on the 'client', I am running: pppd file ./ppp-options ipv6cp-accept-local /dev/ttyAMA0 115200However the ipv6cp-accept-local option doesn't seem to work as the man page describes:With this option, pppd will accept the peer's idea of our local IPv6 interface identifier, even if the local IPv6 interface identifier was specified in an option.The 'client' machine is instead using a randomly assigned link local address: Using interface ppp0 Connect: ppp0 <--> /dev/ttyAMA0 Deflate (15) compression enabled local LL address fe80::fd28:565e:1186:02ff remote LL address fe80::0000:0000:0000:0001The full output with debug turned on the client is here: https://gist.github.com/njh/ab3282f43c72dcf6932b3693eb7dfca4 And this is my configuration file (used by both): nodetach noauth persist local noip +ipv6I am running Raspberry Pi OS, which has pppd version 2.4.7 installed on both devices.
Configuring pppd to accept link-local IPv6 address from remote peer
Most programs read the system DNS configuration (in /etc/resolv.conf) only once when they start up or when they make their first network access. They don't re-read the configuration if it changes. It appears that on your system, the DNS configuration changes when the network goes up (probably changes from unconfigured to having DNS servers configured). This is very common, and unavoidable if the system isn't always connected to the same network. A way to ensure that programs won't be affected is to run a local DNS caching server. This way, the DNS configuration for applications can be static (always nameserver 127.0.0.1 in /etc/resolv.conf), and only the DNS caching server needs to be told about the servers provided by the network connection. Dnsmasq is a common choice, especially on embedded systems (if you have a Linux router, it probably runs dnsmasq). If you're building your own image with Buildroot, include the dnsmasq package. If you have a pre-built image without dnsmasq, installing dnsmasq via Builtroot may still be the best bet but I'm not familiar with Buildroot so I can't explain how to do it.
This is related to a stackoverflow post I posted. Basically I have a Python script that I'm running on an embedded system (Buildroot-based). The python script runs on startup, but I cannot guarantee that the internet connection will be up by then (based on pppd), because the unit might not be in an area with mobile phone signal. What I've found is that if the python code starts before an internet connection has been established on the machine, even after the connection is established, the python code is still unable to resolve names. I get a [Errno -3] Temporary failure in name resolution error when the socket tries to connect. The only way I can get it to work is to establish the internet connection at least once before I start the python code. What changes are being made to the system after the internet connection is established at least once that the Python code could be looking for? Is there something I can set up on boot up so that this does not happen?
Program cannot resolve host name if it's started before first successful internet connection
The only option that exists inside pptp(Client) is to enforce default route through ppp server:And at the server there is no way to "push" routes the same way it can be done using an OpenVPN server. Microsoft KB Taking a look at the How VPN Works page from Microsft it explicitly says that you will need to rely on other protocols(like RIP) to create dinamic routng environment:Dynamic Routing By implementing a dynamic routing protocol, such as RIP or Open Shortest Path First (OSPF), administrators can configure routers to exchange routing information with each other as needed.If Linux is client, this is a solution: It is distribution dependent, but on CentOS(depending on version being used) you can create the file /etc/ppp/ip-up.local or /etc/ppp/ip-up with the following contents: #!/bin/bash /sbin/ip route add 192.168.10.0/24 via 192.168.1.1 /sbin/ip route add 192.168.20.0/24 via 192.168.1.1I'm assuming that 192.168.1.1 as the ip to traffic manually routes to those networks here. Isn't something 192.168.100.0/24? To auto delete those routes when disconnecting a pptp tunnel, just create a /etc/ppp/ip-down.local file with the following contents: #!/bin/bash /sbin/ip route del 192.168.10.0/24 /sbin/ip route del 192.168.20.0/24
I have an OperWRT router with OPenVPN and PPPD servers configured. Network topology is like follow:I have problem configuring PPPD to push routes B,C to A. Client A, when connected to router via PPPD, has access to D, but not to B/C On the other side machines on D network has access to B and C without any extra configuration. Right now I add static route on client with route add ... command, but this is inconvienent.
PPPD access to networks behind router [closed]
Your Issue I would recommend a separate routing table for this, since I assume the traffic arriving at 192.168.0.2 has a source address of 35.100.100.35. The issue you're having is that 35.100.100.35 isn't listed in your routing table, so the default is being used. You might be able to get away with something as simple as: ip route add 35.0.0.0/8 via 192.168.0.1 dev ppp0So that when your machine tries to respond to a 35 address, it does so on the ppp0 interface. The more robust/elaborate version follows. NOTE: You should reboot your machine to clear out any temporary changes you've made to your routing table.Routing Rules A simple enough routing rule is to have any traffic that is destined to or from a specific IP or subnet to use a different routing table: ip rule add from [interface ip]/[netmask] tab [table number] priority [priority] ip rule add to [interface ip]/[netmask] tab [table number] priority [priority]In this case you're concerned about traffic arriving at 192.168.0.2 (your ppp0 device IP). You'll need to create a new routing table by adding to the file: /etc/iproute2/rt_tables. The syntax is [table number] [table name]. I normally use the interface name as the table name, keep things simple. echo "168 ppp0" >> /etc/iproute2/rt_tables ip rule add from 192.168.0.2/32 tab 168 priority 101 ip rule add to 192.168.0.2/32 tab 168 priority 101This should cause all traffic addressed to 192.168.0.2 to match routing table 168, as well as any traffic that is in response to traffic in that table.Using New Routing Tables Now we've directed traffic to that routing table 168, but it would be empty, only need to add a default route to it now. ip route add default via 192.168.0.1 dev ppp0 table 168This adds a default route to table 168, which is simply to say use interface ppp0.What It Looks Like Your routing tables in the end should probably look like this: # ip route show default dev eth0 proto static metric 1024 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.20 192.168.0.0/24 dev ppp0 proto kernel scope link src 192.168.0.2This is your standard routing table, the table normally used for traffic. As for the routes here: the default as you've probably originally defined, and the second two are inferred based on the IP address of your interfaces. # ip rule show 0: from all lookup local 101: from 192.168.0.2 lookup ppp0 101: from all to 192.168.0.2 lookup ppp0This lists your routing rules, format is "[priority]: [rule] lookup [table]". This example states that normally, use the local routing table. If the traffic is to or from 192.168.0.2 use the routing table named ppp0. # ip route show table ppp0 default via 192.168.0.1 dev ppp0This shows the routing table named ppp0, which should just send all traffic out ppp0.End Result The end result of this is that when traffic is heading to or from the IP of your ppp0 interface, it will use the routing table called ppp0. The routing table ppp0 just send all traffic out device ppp0.
I used this guide to connect to my VPN server (pptp) which is the only one guide that worked from many tutorials. After connecting to the VPN server the route table looks like below and sometimes it's only the last 2 lines (very random I'm sure there's a reason). Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 255.255.255.255 UGH 0 0 0 ppp0 192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0My set up: (IPs changed in example to make it simple)Local computer (centos) running on 192.168.1.20 This connects to external VPN (ubuntu) on 35.100.100.35 (internet) with internal VPN local IP 192.168.0.1 When centos is connected, interface ppp0 gets added with the IP 192.168.0.2However, I need all traffic from 192.168.0.2 to be routed via 192.168.0.1 (vpn server). Currently it uses local internet. I've tried so many variations and cannot get it right. route add default ppp0 used to work but with the route tables destroyed it's not working anymore. What should the route table look like?
route table with eth0 and ppp0 broken
As it turns out, PPP is affecting it's own serial port, and since that's the one that's used to configure the GPS, that's what's causing the problem. By comparing the results of stty -F /dev/ttyUSB3 before and after running PPP, it became apparent that PPP was configuring the serial port in raw mode, which meant I couldn't use it to configure the GPS port. What's interesting is that these settings persisted even after the ttyUSBx device nodes were removed and recreated due to the modem being reset. Simply running stty sane -F /dev/ttyUSB3 to revert back to default settings allowed me to configure the GPS port without issue.
I've got a Buildroot-based embedded system that uses a 3G modem (Cinterion PH8-P) and PPP to connect to the internet. The 3G modem is a USB device that provides 4 ttyUSB ports. One of these is used for PPP, whereas another is used for GPS. Occasionally, the 3G modem will stop working and will need to be restarted. I do this by first stopping the PPP and GPSd daemons, then restarting the modem, and then restarting the daemons again. Unfortunately, it seems that if PPP is run beforehand, it seems to affect the serial ports in some way so that other programs can no longer use them. For example, if I run the following on a freshly booted system where PPP has not been run yet: cat /dev/ttyUSB3& echo "AT" > /dev/ttyUSB3I get the expected OK AT response back. If I then run PPP for a bit (by calling pon), then stop it (by calling poff), restart the modem and try to send the same AT command again, the terminal just seems to echo back exactly what I sent to the modem and I don't get the OK response. As a result, the GPS won't work, since I stop receiving NMEA messsages from the GPS tty port. It's almost like PPP is configuring all the serial ports to redirect their outputs somewhere else. Despite this, PPP has no problem at all starting up again after the modem has rebooted - according to the logs, the chat scripts happily send their AT commands and get the expected responses back. What could be causing this issue?
ppp affecting serial ports so that they cannot be used if modem is reset
I figured out the answer. The problem was that Verizon will cut a connection if it receives 10 invalid packets in a span of 2 minutes. The problem was that I wasn't NATing packets properly since I was also using this as a router. The packets being sent out from the bridged lan were being sent to verizon with a source IP of 192.168.123.XXX. Verizon (rightly so) decided that these packets were invalid and would shut off the connection. The solution was to simply add this Iptables rule: iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
I am trying to establish a cellular connection to Verizon through my Multitech Multiconnect Dragonfly (MTQ-LVW3-B02). I am able to connect to Verizons network and get an IP address. The problem is that after a few seconds the modem hangs up the connection. Mar 26 19:26:57 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm- ppp-plugin: (nm_ip6_up): sending IPv6 config to NetworkManager... Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-up started (pid 10367) Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-up finished (pid 10367), status = 0x0 Mar 26 19:26:57 localhost pppd[10353]: sent [IPCP ConfReq id=0x3 <addr 100.113.208.106> <ms-dns1 198.224.160.135> <ms-dns2 198.224.164.135>] Mar 26 19:26:57 localhost pppd[10353]: rcvd [IPV6CP ConfAck id=0x2 <addr fe80::0000:0052:19b4:d801>] Mar 26 19:26:57 localhost pppd[10353]: local LL address fe80::0000:0052:19b4:d801 Mar 26 19:26:57 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_ip_up): ip-up event Mar 26 19:26:57 localhost pppd[10353]: remote LL address fe80::6dac:d335:a09b:525b Mar 26 19:26:57 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_ip_up): sending IPv4 config to NetworkManager... Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ip-up started (pid 10369) Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ipv6-up started (pid 10367) Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ipv6-up finished (pid 10367), status = 0x0 Mar 26 19:26:57 localhost pppd[10353]: rcvd [IPCP ConfAck id=0x3 <addr 100.113.208.106> <ms-dns1 198.224.160.135> <ms-dns2 198.224.164.135>] Mar 26 19:26:57 localhost NetworkManager[2071]: <info> [1522092417.0839] ppp-manager: (IPv4 Config Get) reply received. Mar 26 19:26:57 localhost pppd[10353]: local IP address 100.113.208.106 Mar 26 19:26:57 localhost pppd[10353]: remote IP address 100.113.208.106 Mar 26 19:26:57 localhost pppd[10353]: primary DNS address 198.224.160.135 Mar 26 19:26:57 localhost pppd[10353]: secondary DNS address 198.224.164.135 Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ip-up started (pid 10369) Mar 26 19:26:57 localhost pppd[10353]: Script /etc/ppp/ip-up finished (pid 10369), status = 0x0 Mar 26 19:26:57 localhost NetworkManager[2071]: Script /etc/ppp/ip-up finished (pid 10369), status = 0x0 Mar 26 19:26:57 localhost NetworkManager[2071]: <info> [1522092417.1068] policy: set 'vzw' (ppp0) as default for IPv4 routing and DNS Mar 26 19:26:57 localhost dnsmasq[2407]: using nameserver 198.224.160.135#53(via ppp0) Mar 26 19:26:57 localhost dnsmasq[2407]: using nameserver 198.224.164.135#53(via ppp0) Mar 26 19:26:57 localhost nm-dispatcher: req:4 'up' [ppp0]: new request (1 scripts) Mar 26 19:26:57 localhost nm-dispatcher: req:4 'up' [ppp0]: start running ordered scripts... Mar 26 19:26:57 localhost NetworkManager[2071]: <info> [1522092417.1530] policy: set 'vzw' (ppp0) as default for IPv6 routing and DNS Mar 26 19:27:03 localhost pppd[10353]: Modem hangup Mar 26 19:27:03 localhost pppd[10353]: Connect time 0.1 minutes. Mar 26 19:27:03 localhost pppd[10353]: Sent 1302 bytes, received 1196 bytes. Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ip-down started (pid 10523) Mar 26 19:27:03 localhost pppd[10353]: cif6addr: ioctl(SIOCDIFADDR): No such address Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ip-down started (pid 10523) Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 8 / phase 'network' Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ipv6-down started (pid 10527) Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-down started (pid 10527) Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 5 / phase 'establish' Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 11 / phase 'disconnect' Mar 26 19:27:03 localhost pppd[10353]: Connection terminated. Mar 26 19:27:03 localhost pppd[10353]: Connect time 0.1 minutes. Mar 26 19:27:03 localhost pppd[10353]: Sent 1302 bytes, received 1196 bytes. Mar 26 19:27:03 localhost nm-dispatcher: req:5 'down' [ppp0]: new request (1 scripts) Mar 26 19:27:03 localhost nm-dispatcher: req:5 'down' [ppp0]: start running ordered scripts... Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead' Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ip-down finished (pid 10523), status = 0x0 Mar 26 19:27:03 localhost NetworkManager[2071]: Script /etc/ppp/ipv6-down finished (pid 10527), status = 0x0 Mar 26 19:27:03 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ip-down finished (pid 10523), status = 0x0 Mar 26 19:27:03 localhost NetworkManager[2071]: <info> [1522092423.7625] devices removed (path: /sys/devices/virtual/net/ppp0, iface: ppp0) Mar 26 19:27:03 localhost pppd[10353]: Script /etc/ppp/ipv6-down finished (pid 10527), status = 0x0 Mar 26 19:27:03 localhost pppd[10353]: Exit. Mar 26 19:27:17 localhost NetworkManager[2071]: <info> [1522092437.1293] ppp-manager: starting PPP connection Mar 26 19:27:17 localhost NetworkManager[2071]: <info> [1522092437.1344] ppp-manager: pppd started with pid 10576 Mar 26 19:27:17 localhost pppd[10576]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded. Mar 26 19:27:17 localhost NetworkManager[2071]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded. Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (plugin_init): initializing Mar 26 19:27:17 localhost pppd[10576]: pppd 2.4.7 started by root, uid 0 Mar 26 19:27:17 localhost pppd[10576]: Device ttyACM0 is locked by pid 10520 Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection' Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead' Mar 26 19:27:17 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up Mar 26 19:27:17 localhost pppd[10576]: Exit. Mar 26 19:27:17 localhost NetworkManager[2071]: <warn> [1522092437.1605] ppp-manager: pppd pid 10576 exited with error: Serial port lock failed Mar 26 19:27:28 localhost NetworkManager[2071]: <info> [1522092448.3542] ppp-manager: starting PPP connection Mar 26 19:27:28 localhost NetworkManager[2071]: <info> [1522092448.3592] ppp-manager: pppd started with pid 10589 Mar 26 19:27:28 localhost pppd[10589]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded. Mar 26 19:27:28 localhost NetworkManager[2071]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded. Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (plugin_init): initializing Mar 26 19:27:28 localhost pppd[10589]: pppd 2.4.7 started by root, uid 0 Mar 26 19:27:28 localhost pppd[10589]: Device ttyACM0 is locked by pid 10520 Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection' Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead' Mar 26 19:27:28 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up Mar 26 19:27:28 localhost pppd[10589]: Exit. Mar 26 19:27:28 localhost NetworkManager[2071]: <warn> [1522092448.3865] ppp-manager: pppd pid 10589 exited with error: Serial port lock failed Mar 26 19:27:39 localhost NetworkManager[2071]: <info> [1522092459.7109] ppp-manager: starting PPP connection Mar 26 19:27:39 localhost NetworkManager[2071]: <info> [1522092459.7159] ppp-manager: pppd started with pid 10592 Mar 26 19:27:39 localhost pppd[10592]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded. Mar 26 19:27:39 localhost NetworkManager[2071]: Plugin /usr/lib/pppd/2.4.7/nm-pppd-plugin.so loaded. Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (plugin_init): initializing Mar 26 19:27:39 localhost pppd[10592]: pppd 2.4.7 started by root, uid 0 Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 3 / phase 'serial connection' Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_phasechange): status 1 / phase 'dead' Mar 26 19:27:39 localhost NetworkManager[2071]: nm-pppd-plugin-Message: nm-ppp-plugin: (nm_exit_notify): cleaning up Mar 26 19:27:39 localhost NetworkManager[2071]: <warn> [1522092459.7426] ppp-manager: pppd pid 10592 exited with error: Serial port lock failed Mar 26 19:27:39 localhost pppd[10592]: Device ttyACM0 is locked by pid 10520 Mar 26 19:27:39 localhost pppd[10592]: Exit. Mar 26 19:28:00 localhost NetworkManager[2071]: <warn> [1522092480.2188] ppp-manager: pppd timed out or didn't initialize our dbus moduleI am using nmcli through NetworkManager. I have seen other questions where people believe that the device is not supplying enough power to the USB. I still see the device in lsusb when it's offline though. lsusb Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 002 Device 002: ID 0424:5744 Standard Microsystems Corp. Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 001 Device 005: ID 0424:2740 Standard Microsystems Corp. Bus 001 Device 004: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port Bus 001 Device 003: ID 1bc7:0036 Telit Wireless Solutions Bus 001 Device 002: ID 0424:2744 Standard Microsystems Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hubI have tried adding noipdefault to the options file but that didn't seem to work either. I am at a total loss and any help debugging would be great.
cellular modem: pppd modem hangup
Bingo! Put 'nodetach' as command-line argument to pppd and daemon will not fork itself. All is needed then is standard 'echo $?' in next line of script: pppd call my_provider nodetach maxfail 3 echo $?
I'm designing some reporting system on Raspberry Pi system which connects to world thru 3G usb modem controlled by pppd. 99,999% of time connection works ok, but sometimes it drops and further reconnect attempts fail unless modem is re-plugged physically. As in production box will work remotely with no physical access to it so I have to manage it somehow. My idea is to run at system start, some kind of script in separate thread see below pseudocode: while(true){ wait_for_modem_device_to_appear start_pppd # may_be limiting retries not to default 10, but to, say, 3 wait_for_pppd_to_finish if(exitcode_is_one_of(6,7,8,10,15,16)){ reset_usb_port_programmatically #I have tools for that }else{ break } }How can I get pppd exit code? Should I use another approach (which)?
get pppd exit code - how?
The problem was that I forgot to include ",pty" as an option for EXEC:"/usr/sbin/pppd ..." so pppd was silently crashing.
I am running NetBSD 6.1.4, and I have an stunnel instance with the following configuration: [https service] accept = 443 CAfile = /u01/usbtether/CA/certs/rootCA.crt cert = /usr/pkg/etc/stunnel/stunnel.pem pty = yes exec = /usr/sbin/pppd execargs = pppd call phone verify = 2 client = noEverything works nicely, except for an ever increasing rx error count on the other side. I want to compare the ppp traffic before and after it leaves the stunnel. My strategy thus far is to use socat. I changed the exec lines to point to a shell script like #!/bin/sh socat -,echo=0,raw SYSTEM:'tee /root/pppd-in.log | socat -,echo=0,raw EXEC:"/usr/sbin/pppd call phone" | tee /root/pppd-out.log'But I cannot seem to get my ducks in a row. I've managed to loopback everything the other pppd sends, or ignore everything the other pppd sends, but I cannot get the syntax right to actually pass the data between stunnel and pppd while also dumping input and output to a file(although I only care about output). I've also tried #!/bin/sh /usr/sbin/pppd call phone | tee /root/serial-out.logBut I just seem to send gibberish back to the calling pppd (I assume the pipe through tee is like not including raw in socat?). So what is the best way to snoop on the data in a PTY? For added interest, the data I receive on the other side of the stunnel is occasionally scrambled a little bit. For example, I may receive a ppp frame with an IP packet of length 100, followed by a 0x7e, and 10 additional bytes. Another frame, (which may have arrived several frames before or after the frame with extra bytes) will arrive with an IP packet that is missing 8 bytes. If I were to take that extra chunk and tack it onto the end, I would have, presumably, the correct IP packet plus the FCS. My intention with the PTY snoop is to verify if pppd is sending the data like that (since the missing chunk is always preceded by a 0x7e byte, I think this is likely), or if something weird is happening in transit.
How to capture data transferred on a PTY?
PPP can run protocols other than IP; the most common is of course IPv6. But numerous others have been (and maybe still are) run over PPP. Wikipedia even has a list of protocols that run over PPP, though I'm not sure how many work on Linux. Also — the reason you run PPP over a serial link is because you want to run a higher-level protocol like IP. If you want to avoid that overhead, just use the serial link directly. Serial links don't require PPP; you can send raw binary data over RS232 using whatever application-specific protocol you'd like.
I'm using a PPP to communicate with a device. So far what I have been doing is instantiating PPP on my machine (Fedora 29) and on the device (Yocto Linux). Then I open a TCP/UDP socket and communicate with the device. My serial link (which is why I use PPP) has low baud rate, 4800 to be exact. I cannot change it, it is a project requirement. I've been doing some reading about PPP and as far as I understand I can't just instantiate it and use it raw. I'm have to use TCP/IP/UDP. Am I correct? In other words once I have a PPP connection the only way to use is to open a socket (UDP or TCP) and talk to the device through it. I can't just create my application level packet and tell PPP to send it, I have to go through TCP/IP layer (transport layer).
using PPP without TCP/IP
After a day of debugging it turned out to be an issue with the custom board. One of the pins in the connector turned out to be electrically damaged. So it is not an issue with Fedora or PPP, it is an issue with the hardware connector. Thank you everyone for looking into it.
Had no problems with ppp. Ran and update and it stopped working. My setup: Lenovo T470s with Fedora 28, Linux user-fedora 4.18.13-200.fc28.x86_64 #1 SMP Wed Oct 10 17:29:59 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux custom board with Linux custom-board-0 4.14.0-xilinx-v2018.2 #1 SMP PREEMPT Mon Sep 24 12:55:51 PDT 2018 armv7l armv7l armv7l GNU/Linux Command to run ppp on Fedora 28 sudo pppd -detach local debug noauth passive xonxoff lock dump 192.168.10.100:192.168.10.1 /dev/ttyUSB0 9600`Command to run ppp on custom board pppd -detach persist debug local noauth passive xonxoff lock dump 192.168.10.1:192.168.10.100 /dev/ttyS0 9600Output of ppp on Fedora after command execution pppd options in effect: debug # (from command line) -detach # (from command line) dump # (from command line) noauth # (from command line) /dev/ttyUSB0 # (from command line) 9600 # (from command line) lock # (from command line) xonxoff # (from command line) local # (from command line) passive # (from command line) 192.168.10.100:192.168.10.1 # (from command line) using channel 16 Using interface ppp0 Connect: ppp0 <--> /dev/ttyUSB0 sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] LCP: timeout sending Config-RequestsOutput of ppp on custom board after command execution pppd options in effect: debug # (from command line) -detach # (from command line) persist # (from command line) dump # (from command line) noauth # (from command line) /dev/ttyS0 # (from command line) 9600 # (from command line) lock # (from command line) xonxoff # (from command line) local # (from command line) passive # (from command line) 192.168.10.1:192.168.10.100 # (from command line) using channel 11 Using interface ppp0 Connect: ppp0 <--> /dev/ttyS0 sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x4b51417a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] LCP: timeout sending Config-Requests rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfAck id=0x1 <asyncmap 0xa0000> <magic 0x1aa6d871> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <asyncmap 0xa0000> <magic 0x82da991a> <pcomp> <accomp>] LCP: timeout sending Config-RequestsIt looks like Fedora is sending LCP packets and Custom Board is receiving them, and Custom Board is sending LCP packets but Fedora is not receiving them. Does anyone know what could be the problem and how to fix it?
ppp stopped working on Fedora 28 [closed]
I don't really understand, but : modprobe nf_conntrack_pptpand opening VPN via the GUI, instead of terminal, does the job :-/
So I've been pulling my hair this weekend. I've been trying to connect to a VPN server. I could do it successfully at my office using Windows, but I can't do it in my house using OpenSUSE. Here's the setup in my Linux box : # This module isn't loaded initially modprobe nf_conntrack_pptp pptpsetup --create my_vpn --server xxx.xx.xxx.xx --username xxx --password xxx pppd call my_vpn debug nodetachAnd the results are the following: using channel 6 Using interface ppp0 Connect: ppp0 <--> /dev/pts/4 sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xac5d988f> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <auth chap MS-v2> <mru 1460> <magic 0x72d37196>] sent [LCP ConfAck id=0x1 <auth chap MS-v2> <mru 1460> <magic 0x72d37196>] rcvd [LCP ConfRej id=0x1 <asyncmap 0x0> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <magic 0xac5d988f>] rcvd [LCP ConfAck id=0x2 <magic 0xac5d988f>] sent [LCP EchoReq id=0x0 magic=0xac5d988f] rcvd [CHAP Challenge id=0x1 <96a56e74b0a9c972625e5b2a6cfa7ff3>, name = "PS-RTR-INT@DC-CYBERCSF"] added response cache entry 0 sent [CHAP Response id=0x1 <6878d2f9bafc93c3fd22d7ef83a17cea000000000000000053ed1f4039642a8acec3150b3168abc02cbfa9368595c2a900>, name = "imam"] rcvd [LCP EchoRep id=0x0 magic=0x72d37196] rcvd [CHAP Success id=0x1 "S=FB862D3ADF2E8883281F43948FDAF07A06F71780"] response found in cache (entry 0) CHAP authentication succeeded sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>] rcvd [IPCP ConfReq id=0x1 <addr 20.20.20.1>] sent [IPCP ConfAck id=0x1 <addr 20.20.20.1>] rcvd [proto=0x8281] 01 01 00 04 Unsupported protocol 'MPLSCP' (0x8281) received sent [LCP ProtRej id=0x3 82 81 01 01 00 04] rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>] sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>] rcvd [IPCP ConfNak id=0x2 <addr 20.20.20.10>] sent [IPCP ConfReq id=0x3 <addr 20.20.20.10>] rcvd [IPCP ConfAck id=0x3 <addr 20.20.20.10>] local IP address 20.20.20.10 remote IP address 20.20.20.1 Terminating connection due to lack of activity. Connect time 45.9 minutes. Sent 12744 bytes, received 1344 bytes. sent [LCP TermReq id=0x4 "Link inactive"] rcvd [LCP TermAck id=0x4] Connection terminated. tcflush failed: Input/output error Script pptp xxx.xx.xx.xx --nolaunchpppd finished (pid 4616), status = 0x0As you can see, the connection is terminated due to lack of activity. The local IP address (20.20.20.10) refers to my computer obviously and I can use it normally, but the remote one (20.20.20.1) still not usable. Is there anything wrong in my setup?
VPN Client in OpenSUSE
I found the answer, I had to enable Point-to-Point encryption(MPPE) in the Advanced Settings dialog. Now it works.
I cannot connect to my PPTP VPN server, even though the CHAP authentication succeeds. This is from /var/log/syslog: Jun 11 07:27:22 aspire pppd[32221]: CHAP authentication succeeded Jun 11 07:27:22 aspire pppd[32221]: LCP terminated by peer (MPPE required but cannot negotiate MPPE key length) Jun 11 07:27:22 aspire pptp[32232]: nm-pptp-service-32219 log[pptp_read_some:pptp_ctrl.c:544]: read returned zero, peer has closed
PPTP VPN error: LCP terminated by peer
In the OSX 1.9 pppd source code, I found this in Helpers/pppd/pppd.h: #ifdef __APPLE__ #define EXIT_TERMINAL_FAILED 20 #define EXIT_DEVICE_ERROR 21 #endif #ifdef MAXOCTETS #ifdef __APPLE__ #define EXIT_TRAFFIC_LIMIT 22 #else #define EXIT_TRAFFIC_LIMIT 20 #define EXIT_CNID_AUTH_FAILED 21 #endif #endif #ifdef __APPLE__ #define EXIT_PEER_NOT_AUTHORIZED 23 #define EXIT_CNID_AUTH_FAILED 24 #define EXIT_PEER_UNREACHABLE 25 #endifSo Apple has some exit codes of its own, and yours is defined as EXIT_PEER_UNREACHABLE. Without going into too much detail, it looks like this exit code is only used if a plugin fails (at Helpers/pppd/main.c line 638).
If my machine (OSX 10.9.2) is not connected to the Internet and I want to establish pptp connection by using pppd: $ sudo /usr/sbin/pppd serviceid 5BE14D3A-7B94-4704-ADE0-9883B189199E debug logfile /tmp/ppp.log plugin /System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp plugin pptp.ppp remoteaddress 11.22.33.44 redialcount 1 redialtimer 5 idle 1800 mru 1500 mtu 1448 receive-all novj 0:0 noipdefault ipcp-accept-local ipcp-accept-remote user bbbbbb password cccccc hide-password noaskpassword looplocal defaultroute usepeerdns mppe-128 nodetach logfd 1pppd outputs: Thu Mar 27 15:09:30 2014 : publish_entry SCDSet() failed: Success! Thu Mar 27 15:09:30 2014 : publish_entry SCDSet() failed: Success!and terminates with exit code 25: $ echo $? 25Why pppd returns with exit code which is not documented? Expected exit codes are in the range [0, 19]. Where does this exit code come from? Does this exit code have description? Are there any other "hidden" exit codes for pppd? If I connect to the Internet and run the same command, pptp connection gets established. Last couple of lines of dtruss output are: $ /usr/bin/sudo dtruss /usr/sbin/pppd serviceid 5BE14D3A-7B94-4704-ADE0-9883B189199E debug logfile /tmp/ppp.log plugin /System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp plugin pptp.ppp remoteaddress 11.22.33.44 redialcount 1 redialtimer 5 idle 1800 mru 1500 mtu 1448 receive-all novj 0:0 noipdefault ipcp-accept-local ipcp-accept-remote user bbbbbbb password cccccccc hide-password noaskpassword looplocal defaultroute usepeerdns mppe-128 nodetach logfd 1 Fri Mar 28 10:31:10 2014 : publish_entry SCDSet() failed: Success! Fri Mar 28 10:31:10 2014 : publish_entry SCDSet() failed: Success! Fri Mar 28 10:31:10 2014 : PPTP connecting to server '11.22.33.44' (77.75.123.187)... Fri Mar 28 10:31:10 2014 : PPTP connect errno = 49 Can't assign requested address SYSCALL(args) = return close(0x3) = 0 0 getuid(0x0, 0x1103, 0x7FFF772B14E0) = 0 0 getgid(0x0, 0x1103, 0x0) = 0 0 getuid(0x7FDEA8D00A80, 0x0, 0x1) = 0 0 seteuid(0x0, 0x0, 0x0) = 0 0 open_nocancel("/var/root/.ppprc\0", 0x0, 0x1B6) = -1 Err#2 seteuid(0x0, 0x7FFF76AB4430, 0xFFFFFFFFFFFFFFFF) = 0 0 open("/tmp/ppp.log\0", 0xA09, 0x1A4) = -1 Err#17 open("/tmp/ppp.log\0", 0x9, 0xFFFFFFFFFFFFFFFF) = 3 0 open_nocancel("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp\0", 0x1100004, 0x7FDEA8D00D70) = 4 0 __sysctl(0x7FFF54902F38, 0x2, 0x7FFF76AB4180) = 0 0 fstatfs64(0x4, 0x7FFF54902F88, 0x0) = 0 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 88 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 0 0 close_nocancel(0x4) = 0 0 open_nocancel("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents\0", 0x1100004, 0x7FDEA8D01173) = 4 0 fstatfs64(0x4, 0x7FFF54902F58, 0x0) = 0 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 240 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 0 0 close_nocancel(0x4) = 0 0 open("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents/Info.plist\0", 0x0, 0x1B6) = 4 0 fstat64(0x4, 0x7FFF54903218, 0x0) = 0 0 read(0x4, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>BuildMachineOSBuild</key>\n\t<string>13C40z</string>\n\t<key>CFBundleDevelopmentReg", 0x4F1) = 1265 0 close(0x4) = 0 0 stat64("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents/MacOS/PPPDialogs\0", 0x7FFF54903C08, 0x7FFF54904156) = 0 0 stat64("/usr/lib/libesp.dylib\0", 0x7FFF549031C8, 0x7FFF54904070) = -1 Err#2 stat64("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents/MacOS/PPPDialogs\0", 0x7FFF54902E88, 0x7FFF54903D30) = 0 0 stat64("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents/MacOS/PPPDialogs\0", 0x7FFF54903B18, 0xF9A90) = 0 0 open("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents/MacOS/PPPDialogs\0", 0x0, 0x1FF) = 4 0 read(0x4, "\317\372\355\376\a\0", 0x200) = 512 0 close(0x4) = 0 0 stat64("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents/MacOS/PPPDialogs\0", 0x7FFF54902E68, 0x7FFF54903D10) = 0 0 open("/System/Library/SystemConfiguration/PPPController.bundle/Contents/PlugIns/PPPDialogs.ppp/Contents/MacOS/PPPDialogs\0", 0x0, 0x0) = 4 0 pread(0x4, "\317\372\355\376\a\0", 0x1000, 0x0) = 4096 0 fcntl(0x4, 0x3D, 0x7FFF54901190) = 0 0 mmap(0x10B38C000, 0x2000, 0x5, 0x12, 0x4, 0x0) = 0x10B38C000 0 mmap(0x10B38E000, 0x1000, 0x3, 0x12, 0x4, 0x2000) = 0x10B38E000 0 mmap(0x10B38F000, 0x26F0, 0x1, 0x12, 0x4, 0x3000) = 0x10B38F000 0 close(0x4) = 0 0 open_nocancel("/System/Library/Extensions/pptp.ppp\0", 0x1100004, 0x7FDEA8D02370) = 4 0 fstatfs64(0x4, 0x7FFF54902F88, 0x0) = 0 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 88 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 0 0 close_nocancel(0x4) = 0 0 open_nocancel("/System/Library/Extensions/pptp.ppp/Contents\0", 0x1100004, 0x7FDEA8D02573) = 4 0 fstatfs64(0x4, 0x7FFF54902F58, 0x0) = 0 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 232 0 getdirentries64(0x4, 0x7FDEAA000600, 0x1000) = 0 0 close_nocancel(0x4) = 0 0 open("/System/Library/Extensions/pptp.ppp/Contents/Info.plist\0", 0x0, 0x1B6) = 4 0 fstat64(0x4, 0x7FFF54903218, 0x0) = 0 0 geteuid(0x100000001103, 0x110000001100, 0x10B356308) = 0 0 setsid(0x50000000603, 0x60000000600, 0x7FFF772B15A8) = 3077 0 socket(0x22, 0x3, 0x1) = 3 0 connect(0x3, 0x7FFF549046B0, 0x8) = 0 0 fcntl(0x3, 0x3, 0x0) = 2 0 fcntl(0x3, 0x4, 0x6) = 0 0 socket(0x2, 0x2, 0x0) = 4 0 open_nocancel("/usr/sbin\0", 0x1100004, 0x7FFF922AEB6E) = 5 0 fstatfs64(0x5, 0x7FFF549031B8, 0x0) = 0 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 4080 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 4072 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 648 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 0 0 close_nocancel(0x5) = 0 0 stat64("/usr/sbin/Contents\0", 0x7FFF549039D8, 0x7FFF54903ABF) = -1 Err#2 stat64("/usr/sbin/Resources\0", 0x7FFF549039D8, 0x7FFF54903ABF) = -1 Err#2 stat64("/usr/sbin/Support Files\0", 0x7FFF549039D8, 0x7FFF54903ABF) = -1 Err#2 stat64("/usr/sbin\0", 0x7FFF54903F58, 0x7FFF5490406B) = 0 0 open_nocancel("/usr/sbin\0", 0x1100004, 0x7FFF922AEB6E) = 5 0 fstatfs64(0x5, 0x7FFF54903188, 0x0) = 0 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 4080 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 4072 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 648 0 getdirentries64(0x5, 0x7FDEAA000600, 0x1000) = 0 0 close_nocancel(0x5) = 0 0 stat64("/usr/sbin/pppd\0", 0x7FFF54903DC8, 0x7FFF54903E7E) = 0 0 open("/usr/sbin/pppd\0", 0x0, 0x1FF) = 5 0 read(0x5, "\317\372\355\376\a\0", 0x200) = 512 0 close(0x5) = 0 0 geteuid(0x7FDEA8D00030, 0x7FFF76F80258, 0x49656E69) = 0 0 kevent64(0x5, 0x7FFF549043A8, 0x1) = 1 0 open("/dev/null\0", 0x2, 0x0) = 6 0 __sysctl(0x7FFF54903AC0, 0x2, 0x7FFF54903AD0) = 0 0 getuid(0x7FDEAA001743, 0x7FFF54903D60, 0x0) = 0 0 getgid(0x7FDEAA001748, 0x7FFF54903D60, 0x0) = 0 0 sigaction(0x1, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x2, 0x7FFF54904758, 0x0) = 0 0 sigaction(0xF, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x14, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x12, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x13, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x1E, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x1F, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x6, 0x7FFF54904758, 0x0) = 0 0 sigaction(0xE, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x8, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x4, 0x7FFF54904758, 0x0) = 0 0 sigaction(0xD, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x3, 0x7FFF54904758, 0x0) = 0 0 sigaction(0xB, 0x7FFF54904758, 0x0) = 0 0 sigaction(0xA, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x7, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x1B, 0x7FFF54904758, 0x0) = 0 0 sigaction(0xC, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x5, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x1A, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x18, 0x7FFF54904758, 0x0) = 0 0 sigaction(0x19, 0x7FFF54904758, 0x0) = 0 0 stat64("/System/Library/Frameworks/Security.framework/Security\0", 0x7FFF549040D0, 0x7FFF8E1A1463) = 0 0 stat64("/System/Library/Frameworks/Security.framework/Security\0", 0x7FFF54903188, 0x7FFF54904030) = 0 0 csops(0xC05, 0x7, 0x7FFF54904510) = 0 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 kevent64(0x5, 0x0, 0x0) = 1 0 kevent64(0x5, 0x10B3AC3C8, 0x1) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 kevent64(0x5, 0x0, 0x0) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 kevent64(0x5, 0x7FFF75519130, 0x1) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 kevent64(0x5, 0x10BC80D88, 0x1) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 __sysctl(0x7FFF54903A90, 0x2, 0x7FFF54903AA0) = 0 0 getuid(0x7FDEAA00170E, 0x7FFF54903D30, 0x0) = 0 0 getgid(0x7FDEAA001713, 0x7FFF54903D30, 0x0) = 0 0 csops(0x0, 0x0, 0x7FFF54903F04) = 0 0 issetugid(0x0, 0x0, 0x0) = 0 0 pread(0x3, "\312\376\272\276\0", 0x1000, 0x0) = 4096 0 pread(0x3, "\317\372\355\376\a\0", 0x1000, 0x1000) = 4096 0 fcntl(0x3, 0x3D, 0x7FFF54901350) = 0 0 mmap(0x10B357000, 0x2000, 0x5, 0x12, 0x3, 0x1000) = 0x10B357000 0 mmap(0x10B359000, 0x1000, 0x3, 0x12, 0x3, 0x3000) = 0x10B359000 0 mmap(0x10B35A000, 0x2050, 0x1, 0x12, 0x3, 0x4000) = 0x10B35A000 0 close(0x3) = 0 0 stat64("/usr/lib/libbsm.0.dylib\0", 0x7FFF54902D98, 0x7FFF54903C30) = 0 0 stat64("/System/Library/Frameworks/SystemConfiguration.framework/Versions/A/SystemConfiguration\0", 0x7FFF54902D98, 0x7FFF54903C30) = 0 0 stat64("/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation\0", 0x7FFF54902D98, 0x7FFF54903C30) = 0 0 stat64("/usr/lib/libSystem.B.dylib\0", 0x7FFF54902D98, 0x7FFF54903C30) = 0 0 stat64("/System/Library/Frameworks/IOKit.framework/Versions/A/IOKit\0", 0x7FFF54902D98, 0x7FFF54903C30) = 0 0 stat64("/System/Library/Frameworks/Security.framework/Versions/A/Security\0", 0x7FFF54902D98, 0x7FFF54903C30) = 0 0 stat64("/usr/lib/system/libcache.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libcommonCrypto.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libcompiler_rt.dylib\0", 0x7FFF54902908, 0x7FFF549037A0 = 0 0 stat64("/usr/lib/system/libcopyfile.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libcorecrypto.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libdispatch.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libdyld.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libkeymgr.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/liblaunch.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libmacho.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libquarantine.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libremovefile.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_asl.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_blocks.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_c.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_configuration.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_dnssd.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_info.dylib\0", 0x7FFF54902908, 0x7FFF549037A0 = 0 0 stat64("/usr/lib/system/libsystem_kernel.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_m.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_malloc.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_network.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_notify.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_platform.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_pthread.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_sandbox.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libsystem_stats.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libunc.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libunwind.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/system/libxpc.dylib\0", 0x7FFF54902908, 0x7FFF549037A0) = 0 0 stat64("/usr/lib/libobjc.A.dylib\0", 0x7FFF54901B48, 0x7FFF549029E0) = 0 0 stat64("/usr/lib/libauto.dylib\0", 0x7FFF54901B48, 0x7FFF549029E0) = 0 0 stat64("/usr/lib/libc++abi.dylib\0", 0x7FFF549015F8, 0x7FFF54902490) = 0 0 stat64("/usr/lib/libc++.1.dylib\0", 0x7FFF549015F8, 0x7FFF54902490) = 0 0 stat64("/usr/lib/libDiagnosticMessagesClient.dylib\0", 0x7FFF549014D8, 0x7FFF54902370) = 0 0 stat64("/usr/lib/libicucore.A.dylib\0", 0x7FFF54902B18, 0x7FFF549039B0) = 0 0 stat64("/usr/lib/libz.1.dylib\0", 0x7FFF54902B18, 0x7FFF549039B0) = 0 0 stat64("/usr/lib/system/libkxld.dylib\0", 0x7FFF54902C48, 0x7FFF54903AE0) = 0 0 stat64("/usr/lib/libxar.1.dylib\0", 0x7FFF54902BA8, 0x7FFF54903A40) = 0 0 stat64("/usr/lib/libsqlite3.dylib\0", 0x7FFF54902BA8, 0x7FFF54903A40) = 0 0 stat64("/usr/lib/libpam.2.dylib\0", 0x7FFF54902BA8, 0x7FFF54903A40) = 0 0 stat64("/usr/lib/libOpenScriptingUtil.dylib\0", 0x7FFF54902BA8, 0x7FFF54903A40) = 0 0 stat64("/usr/lib/libbz2.1.0.dylib\0", 0x7FFF54902A78, 0x7FFF54903910) = 0 0 stat64("/usr/lib/libxml2.2.dylib\0", 0x7FFF54902A78, 0x7FFF54903910) = 0 0 getpid(0x7FFF54903CF8, 0x10B352004, 0xEA60) = 3077 0 shm_open(0x7FFF92E96CE4, 0x0, 0x0) = 3 0 mmap(0x0, 0x1000, 0x1, 0x1, 0x3, 0x0) = 0x10B38B000 0 close_nocancel(0x3) = 0 0 geteuid(0x20000000303, 0x30000000300, 0x10B356308) = 0 0 __sysctl(0x7FFF54904640, 0x2, 0x7FFF54904650) = 0 0 umask(0x1FF, 0x0, 0xFFFFFFFFFFFFFFE0) = 18 0 umask(0x12, 0x0, 0x0) = 511 0 getuid(0x12, 0x0, 0x0) = 0 0 getgroups(0x10, 0x10B33EE20, 0x0) = 13 0 __sysctl(0x7FFF54904738, 0x2, 0x7FFF5490472C) = 0 0 getrlimit(0x1008, 0x7FFF54903DA0, 0x7FFF8BF3CE7C) = 0 0 open_nocancel("/etc/ppp/options\0", 0x0, 0x1B6) = -1 Err#2 getuid(0x4, 0x7FFF76AB4430, 0xFFFFFFFFFFFFFFFF) = 0 0 read(0x4, "\317\372\355\376\a\0", 0x200) = 512 0 open_nocancel("/etc/ppp/postoptions\0", 0x0, 0x1B6) = -1 Err#2 geteuid(0x20000000303, 0x30000000300, 0x7FFF772B15A8) = 0 0 socket(0x22, 0x3, 0x1) = 4 0 close(0x4) = 0 0 close(0x3) = 0 0 getuid(0x7FDEA8E000C0, 0x0, 0xFFFFFFFFFFFFFF01) = 0 0 getgid(0x7FDEA8E000C0, 0x0, 0x0) = 0 0 write(0x1, "Fri Mar 28 10:31:10 2014 : \0", 0x1B) = 27 0 write(0x1, "publish_entry SCDSet() failed: Success!\0", 0x27) = 39 0 write(0x1, "\n\0", 0x1) = 1 0 __sysctl(0x7FFF54902800, 0x2, 0x7FFF54902810) = 0 0 getuid(0x7FDEA9802330, 0x7FFF54902AA0, 0x0) = 0 0 getgid(0x7FDEA9802335, 0x7FFF54902AA0, 0x0) = 0 0 write(0x1, "Fri Mar 28 10:31:10 2014 : \0", 0x1B) = 27 0 write(0x1, "publish_entry SCDSet() failed: Success!\0", 0x27) = 39 0 write(0x1, "\n\0", 0x1) = 1 0 guarded_kqueue_np(0x7FFF54903E98, 0x3, 0x7FFF86283A77) = 5 0 kevent64(0x5, 0x7FFF86296C48, 0x1) = 0 0 workq_kernreturn(0x10, 0x0, 0x58) = 0 0 workq_open(0x10, 0x0, 0x0) = 0 0 bsdthread_create(0x7FFF86283E77, 0x7FFF75518940, 0x10000) = 188403712 0 kevent64(0x5, 0x7FFF54903F18, 0x1) = 1 0 kevent64(0x5, 0x10BC80D88, 0x1) = 1 0 kevent64(0x5, 0x0, 0x0) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 thread_selfid(0x0, 0x1DC0, 0x7FFF65505550) = 88904 0 shared_region_check_np(0x7FFF54901E38, 0x10B2FB000, 0x4) = 0 0 stat64("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x7FFF54902FE8, 0x7FFF54903F20 = 0 0 open("/usr/lib/dtrace/libdtrace_dyld.dylib\0", 0x0, 0x0) = 3 0 ioctl(0x3, 0x80086804, 0x7FFF54903D78) = 0 0 kevent64(0x5, 0x7FFF75519130, 0x1) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 thread_selfid(0x10BD04000, 0x7FFF77A55258, 0x1010101) = 88912 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 open("/dev/dtracehelper\0", 0x2, 0x7FFF54903DF0) = 3 0 __sysctl(0x7FFF54903648, 0x2, 0x7FFF54903658) = 0 0 thread_selfid(0x7FFF77A55310, 0x7FFF77A55258, 0x10101) = 88904 0 bsdthread_register(0x7FFF92F30FBC, 0x7FFF92F30FAC, 0x2000) = 0 0 mprotect(0x10B353000, 0x88, 0x1) = 0 0 mprotect(0x10B35D000, 0x1000, 0x0) = 0 0 mprotect(0x10B373000, 0x1000, 0x0) = 0 0 mprotect(0x10B374000, 0x1000, 0x0) = 0 0 mprotect(0x10B38A000, 0x1000, 0x0) = 0 0 mprotect(0x10B355000, 0x1000, 0x1) = 0 0 mprotect(0x10B353000, 0x88, 0x3) = 0 0 mprotect(0x10B353000, 0x88, 0x1) = 0 0 issetugid(0x7FFF75518480, 0x7FFFFFE00034, 0x7FFFFFE00036) = 0 0 getpid(0x1, 0x10B356000, 0x49656E69) = 3077 0 __mac_syscall(0x7FFF853DCE3F, 0x2, 0x7FFF549034C8) = 0 0 stat64("/AppleInternal\0", 0x7FFF54903548, 0x0) = -1 Err#2 audit_session_self(0x7FFF54903400, 0x7FFF54903238, 0x4) = 4099 0 geteuid(0x7FFF54903400, 0x7FFF54903238, 0x0) = 0 0 getegid(0x7FFF54903400, 0x7FFF54903238, 0x0) = 0 0 getaudit_addr(0x7FFF549034D8, 0x30, 0x0) = 0 0 csops(0xC05, 0x7, 0x7FFF549030C0) = 0 0 getuid(0x7FFF5490371C, 0x7FFF54903718, 0x7FFF54904960) = 0 0 geteuid(0x103, 0x10000000100, 0x7FFF778F8198) = 0 0 getuid(0x103, 0x10000000100, 0x0) = 0 0 __sysctl(0x7FFF54902BC0, 0x4, 0x7FFF54902BD8) = 0 0 issetugid(0x7FFF778D3DC0, 0x0, 0x7FDEA8C062C8) = 0 0 getuid(0x7FFF54902EE4, 0x0, 0x7FFF54904960) = 0 0 issetugid(0x7FFF8808BA90, 0x7FFF549045F4, 0x7FFF54904960) = 0 0 issetugid(0x7FFF758FA678, 0x0, 0x0) = 0 0 read(0x4, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n\t<key>BuildMachineOSBuild</key>\n\t<string>13C40z</string>\n\t<key>CFBundleDevelopmentReg", 0x4E5) = 1253 0 close(0x4) = 0 0 stat64("/System/Library/Extensions/pptp.ppp/Contents/MacOS/PPTP\0", 0x7FFF54903C08, 0x7FFF54904156) = 0 0 stat64("/System/Library/Extensions/pptp.ppp/Contents/MacOS/PPTP\0", 0x7FFF54902E88, 0x7FFF54903D30) = 0 0 stat64("/System/Library/Extensions/pptp.ppp/Contents/MacOS/PPTP\0", 0x7FFF54903B18, 0xF4290) = 0 0 open("/System/Library/Extensions/pptp.ppp/Contents/MacOS/PPTP\0", 0x0, 0x1FF) = 4 0 close(0x4) = 0 0 stat64("/System/Library/Extensions/pptp.ppp/Contents/MacOS/PPTP\0", 0x7FFF54902E68, 0x7FFF54903D10) = 0 0 open("/System/Library/Extensions/pptp.ppp/Contents/MacOS/PPTP\0", 0x0, 0x0) = 4 0 pread(0x4, "\317\372\355\376\a\0", 0x1000, 0x0) = 4096 0 fcntl(0x4, 0x3D, 0x7FFF54901170) = 0 0 mmap(0x10B392000, 0x5000, 0x5, 0x12, 0x4, 0x0) = 0x10B392000 0 mmap(0x10B397000, 0x1000, 0x3, 0x12, 0x4, 0x5000) = 0x10B397000 0 mmap(0x10B398000, 0x3B00, 0x1, 0x12, 0x4, 0x6000) = 0x10B398000 0 close(0x4) = 0 0 __sysctl(0x7FFF54902800, 0x2, 0x7FFF54902810) = 0 0 getuid(0x7FDEA9001D30, 0x7FFF54902AA0, 0x0) = 0 0 getgid(0x7FDEA9001D35, 0x7FFF54902AA0, 0x0) = 0 0 access("/etc/localtime\0", 0x4, 0x7) = 0 0 open_nocancel("/etc/localtime\0", 0x0, 0x0) = 5 0 fstat64(0x5, 0x7FFF54902B30, 0x0) = 0 0 read_nocancel(0x5, "TZif\0", 0x2A64) = 1323 0 close_nocancel(0x5) = 0 0 thread_selfid(0x10B3AD000, 0x7FFF77A55258, 0x1010101) = 88910 0 __pthread_sigmask(0x1, 0x10B3ACECC, 0x0) = 0 0 kevent64(0x5, 0x10B3AC458, 0x1) = 1 0 madvise(0x10B401000, 0x1000, 0x5) = 0 0 madvise(0x10B601000, 0x1000, 0x5) = 0 0 kevent64(0x5, 0x10B3AC4F8, 0x1) = 1 0 kevent64(0x5, 0x0, 0x0) = 1 0 madvise(0x10B801000, 0x1000, 0x5) = 0 0 kevent64(0x5, 0x10B3AC4F8, 0x1) = 1 0 thread_selfid(0x10BC81000, 0x7FFF77A55258, 0x1010101) = 88911 0 kevent64(0x5, 0x10BC80D28, 0x1) = 1 0 kevent64(0x5, 0x7FFF75519130, 0x1) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 kevent64(0x5, 0x0, 0x0) = 1 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 socket(0x20, 0x3, 0x1) = 7 0 ioctl(0x7, 0x800C6502, 0x7FFF549042D0) = 0 0 __sysctl(0x7FFF54902460, 0x2, 0x7FFF54902470) = 0 0 getuid(0x7FDEA9001D45, 0x7FFF54902700, 0x0) = 0 0 getgid(0x7FDEA9001D4A, 0x7FFF54902700, 0x0) = 0 0 write(0x1, "Fri Mar 28 10:31:10 2014 : \0", 0x1B) = 27 0 write(0x1, "PPTP connecting to server '11.22.33.44' (11.22.33.44)...\0", 0x3C) = 60 0 write(0x1, "\n\0", 0x1) = 1 0 socket(0x2, 0x1, 0x0) = 8 0 setsockopt(0x8, 0x6, 0x20) = 0 0 connect(0x8, 0x7FFF549042E0, 0x10) = -1 Err#49 __sysctl(0x7FFF54902460, 0x2, 0x7FFF54902470) = 0 0 getuid(0x7FDEA9001D3F, 0x7FFF54902700, 0x0) = 0 0 getgid(0x7FDEA9001D44, 0x7FFF54902700, 0x0) = 0 0 write(0x1, "Fri Mar 28 10:31:10 2014 : \0", 0x1B) = 27 0 write(0x1, "PPTP connect errno = 49 Can't assign requested address\0", 0x36) = 54 0 write(0x1, "\n\0", 0x1) = 1 0 close(0x7) = 0 0 close(0x8) = 0 0 workq_kernreturn(0x20, 0x0, 0x1) = 0 0 kevent64(0x5, 0x7FFF75519130, 0x1) = -1 Err#425 in hexadecimal is 0x19 but this number does not appear anywhere.
Undocumented pppd exit code
In order for NAT to work, you need to have a protocol-specific helper module loaded. By default, you're only going to have ones for TCP and UDP loaded. That's why you're seeing your PPTP traffic (which is actually PPP over GRE) escaping without NAT. That module is nf_nat_proto_gre, at least as of Linux 4.4. A similar story applies to connection tracking (without which GRE packets aren't going to be considered part of an established or related connection). That's nf_conntrack_proto_gre. It turns out that PPTP requires special handling too (I'd guess it embeds IP addresses inside the PPP negotiation, but I haven't checked). That special handling is provided by nf_nat_pptp and tracking of PPTP connections is provided by nf_conntrack_pptp. A modprobe ip_nat_pptp should get your VPN working. Dependencies between the modules will wind up loading all four. To make it continue working across boot, add nf_nat_pptp to /etc/modules. (No, I have no idea where this is documented, sorry!)
ORIGINAL: I've just switched from an old Linux install (Debian squeeze) to a new one (Linux Mint 17.3) for my router (I am using a full desktop PC with a Linux install as my router). The Linux PC connects directly to my DSL modem and negotiates a PPPoE connection, then routes internet connections for all my other devices. As far as I can tell, I've set it up the same as the previous Debian install. I had a simple rc.local script to set up iptables, and it's the same on the new box and it's getting run (I have ensured this by running /etc/rc.local from a root console). I've also setup DNS on the new box. Most of the stuff works the same, but I am having one problem: the VPN on my Windows box no longer manages to connect. Looking at Wireshark, I notice that the initial PPTP packets seem to be successfully sent and received, but then there is a "Set-Link-Info" packet sent from my Windows box, and then the Windows box starts setting "PPP LCP Configuration Request" packets. At this point, it receives no response. The Wireshark capture going over my old Debian setup showed that at that point it got responses, eventually resulting in a "PPP LCP Configuration Ack". I really can't figure out what else to check. I don't understand why the PPTP connection is getting stuck here with my new setup. Any ideas as to how I can troubleshoot? Note: Here's the /etc/rc.local I have (it's the same on both installs) that sets up my entire iptables configuration: #!/bin/sh -eecho "*** Running rc.local ***"# First up, make sure 'net.ipv4.ip_forward=1' exists, uncommented, in /etc/sysctl.conf (just do this manually) echo "MAKE SURE net.ipv4.ip_forward=1 EXISTS, UNCOMMENTED, IN /etc/sysctl.conf OR NAT WILL NOT WORK!!!" echo ""# Firewall variables #WAN_IFACE="eth0" # At the time of writing, this is the NIC built into the mobo WAN_IFACE="ppp0" # Virtual PPP interface when using PPPoE LAN_IFACE="eth1" # At the time of writing, this is the extension NIC card LAN_IP="192.168.1.1/24" # Class-C internal network# Setup iptables... flush existing rules iptables -F iptables -t nat -F set +e # Set +e here to continue on error; iptables may give an error if this chain doesn't currently exist and we try to delete it iptables -X LOGGING set -e# Set default policies for chains iptables -P INPUT DROP iptables -P OUTPUT ACCEPT iptables -P FORWARD ACCEPT# Allow all local loopback access iptables -A INPUT -i lo -p all -j ACCEPT iptables -A OUTPUT -o lo -p all -j ACCEPT# Allow incoming traffic for established connections iptables -A INPUT -i $WAN_IFACE -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -i $WAN_IFACE -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -i $LAN_IFACE -p tcp -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A INPUT -i $LAN_IFACE -p udp -m state --state RELATED,ESTABLISHED -j ACCEPT# Allow incoming ICMP traffic iptables -A INPUT -p icmp -j ACCEPT### # Uncomment lines in this section to allow unsolicited incoming traffic on ports ## Open common service ports ## SSH #iptables -A INPUT -i $WAN_IFACE -p tcp --destination-port 22 -j ACCEPT ## HTTP (8080 + 8081) #iptables -A INPUT -i $WAN_IFACE -p tcp --destination-port 8080 -j ACCEPT #iptables -A INPUT -i $WAN_IFACE -p tcp --destination-port 8081 -j ACCEPT iptables -A INPUT -i eth1 -p tcp --destination-port 8080 -j ACCEPT iptables -A INPUT -i eth1 -p tcp --destination-port 8081 -j ACCEPT # DNS iptables -A INPUT -i eth1 -p tcp --destination-port 53 -j ACCEPT iptables -A INPUT -i eth1 -p udp --destination-port 53 -j ACCEPT # Local Samba connections iptables -A INPUT -p tcp --syn -s $LAN_IP --destination-port 139 -j ACCEPT iptables -A INPUT -p tcp --syn -s $LAN_IP --destination-port 445 -j ACCEPT #### NAT setup - allow the NAT masquerading iptables -t nat -A POSTROUTING -o $WAN_IFACE -j MASQUERADE# Allow forwarding of packets between the Internet and local network interface(s) iptables -A FORWARD -i $WAN_IFACE -o $LAN_IFACE -m state --state RELATED,ESTABLISHED -j ACCEPT iptables -A FORWARD -i $LAN_IFACE -o $WAN_IFACE -j ACCEPT# Logging setup iptables -N LOGGING iptables -A LOGGING -m limit --limit 2/min -j LOG --log-prefix="IPTables-Dropped: " --log-level 4 iptables -A LOGGING -j DROP# Logging; uncomment the below to log dropped input packets to syslog (verbose; only use for debugging!) echo "Uncomment the necessary lines in rc.local to enable iptables logging..." #iptables -A INPUT -j LOGGINGecho "*** Finished running rc.local ***"exit 0UPDATE: I've been doing some more investigation into this, and the Wireshark analysis of what's being put out by my Linux router reveals one very significant difference. Here are the two screenshots, first from my old Debian box whose routing works, and second from my new Mint box where it doesn't:I've replaced the IP addresses with red and blue stripes to indicate my Linux router's public IP address, and the remote address with which we are communicating in order to establish a VPN connection through the PPTP protocol. Also, my Windows machine's IP address on the local network is outlined in green. The thing to notice is what happens after the PPTP protocol finishes and we switch to PPP LCP packets. On the Debian box, it continues to convert the source address of these packets to my public IP address before sending them out to the public internet. But on my Linux Mint box, the source address of packets being sent out is still kept as the local network address of my Windows machine that's trying to establish the connection. It's sending packets out to the internet with a local class C source address - of course they're not getting routed! The question is, what is causing the breakdown of NAT here on my Linux Mint box that isn't happening on the Debian box? The iptables are the same, the /etc/network/interfaces are the same. I don't know... but maybe this discovery will help someone here to help me with the problem. :-)
PPTP VPN not working with Linux router
To achieve what I wanted to achieve I had to do the following things: Step 1: Install the PPTP Client Program for Debian Project Step 2: Setup the PPTP connection Step 3: Testing the connection Step 4: Adding the route Step 5: Final check For the first three steps, I mainly followed http://pptpclient.sourceforge.net/howto-debian.phtml. After doing so, I found this great article (https://www.thomas-krenn.com/en/wiki/Two_Default_Gateways_on_One_System), which explains on how to add two default gateways. The main idea behind the second gateway approach, is to create a Second Routing Table in /etc/iproute2/rt_tables (in my case I named it ppp). After this is done, routes are added to this new table and rules are defined: ip route add 10.10.0.0/24 dev eth1 src 10.10.0.10 table ppp ip route add default via 10.10.0.1 dev eth1 table pppip rule add from 10.10.0.10/32 table ppp ip rule add to 10.10.0.10/32 table pppAfter testing, I added the scripts, so that the routes are added and deleted whenever the VPN connection is established, i.e., ip-up script #!/bin/shif [ "$PPP_IPPARAM" = "amsterdam" ] ; then /sbin/ip route add $PPP_LOCAL/24 dev $PPP_IFACE src $PPP_LOCAL table ppp /sbin/ip route add default via $PPP_REMOTE dev $PPP_IFACE table ppp /sbin/ip rule add from $PPP_LOCAL/32 table ppp /sbin/ip rule add to $PPP_LOCAL/32 table ppp fiip-down script #!/bin/shif [ "$PPP_IPPARAM" = "amsterdam" ] ; then /sbin/ip route del $PPP_LOCAL/24 dev $PPP_IFACE src $PPP_LOCAL table ppp /sbin/ip route del default via $PPP_REMOTE dev $PPP_IFACE table ppp /sbin/ip rule del from $PPP_LOCAL/32 table ppp /sbin/ip rule del to $PPP_LOCAL/32 table ppp fiThat works perfectly and I'm able to pick the second gateway whenever needed.
I have Debian 8.0.0-64 running on my server, which has eth1 as the interface with the default gateway. eth0 is pointing to the internal network. root@server:/home/user# ifconfig eth0 Link encap:Ethernet HWaddr 06:46:7e:88:72:d7 inet addr:10.168.118.205 Bcast:10.168.118.255 Mask:255.255.255.192 inet6 addr: fe80::446:7eff:fe88:72d7/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:161 errors:0 dropped:0 overruns:0 frame:0 TX packets:203 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:15215 (14.8 KiB) TX bytes:79027 (77.1 KiB)eth1 Link encap:Ethernet HWaddr 06:70:65:5f:e9:89 inet addr:167.41.133.218 Bcast:167.41.133.223 Mask:255.255.255.240 inet6 addr: fe80::470:65ff:fe5f:e989/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:697 errors:0 dropped:0 overruns:0 frame:0 TX packets:282 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:46420 (45.3 KiB) TX bytes:33486 (32.7 KiB)lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:706 errors:0 dropped:0 overruns:0 frame:0 TX packets:706 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:86847 (84.8 KiB) TX bytes:86847 (84.8 KiB)I set up a VPN (TotalVPN) connection using the following instructions: http://pptpclient.sourceforge.net/howto-debian.phtml#configure_by_hand With pon amsterdam I can actually open a tunnel: root@server:/home/user# pon amsterdamroot@server:/home/user# ifconfig ppp0 Link encap:Point-to-Point Protocol inet addr:10.126.0.29 P-t-P:10.126.0.1 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1496 Metric:1 RX packets:6 errors:0 dropped:0 overruns:0 frame:0 TX packets:6 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:3 RX bytes:60 (60.0 B) TX bytes:66 (66.0 B)So far so good. Now I'd love to be able to ping, e.g., google.com (ping -I ppp0 google.com) through the tunnel, without losing the possibility to use eth1 as my default interface (ping google.com). How can I setup a route or whatever needed, so that traffic (to the internet) can be going through the tunnel, if specifically asked for, i.e., by defining the interface ppp0 to be used? Here is some information (the name of the VPN connection is amsterdam): root@server:/home/user# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 167.41.133.209 0.0.0.0 UG 0 0 0 eth1 10.0.0.0 10.168.118.193 255.0.0.0 UG 0 0 0 eth0 10.168.118.192 0.0.0.0 255.255.255.192 U 0 0 0 eth0 161.26.0.0 10.168.118.193 255.255.0.0 UG 0 0 0 eth0 167.41.133.208 0.0.0.0 255.255.255.240 U 0 0 0 eth1root@server:/home/user# pon amsterdamroot@server:/home/user# route -n Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 0.0.0.0 UG 0 0 0 eth1 10.0.0.0 10.168.118.193 255.0.0.0 UG 0 0 0 eth0 10.126.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 10.168.118.192 0.0.0.0 255.255.255.192 U 0 0 0 eth0 45.32.239.20 167.41.133.209 255.255.255.255 UGH 0 0 0 eth1 161.26.0.0 10.168.118.193 255.255.0.0 UG 0 0 0 eth0 167.41.133.208 0.0.0.0 255.255.255.240 U 0 0 0 eth1root@server:/home/user# poff amsterdamroot@server:/home/user# route -nKernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 167.41.133.209 0.0.0.0 UG 0 0 0 eth1 10.0.0.0 10.168.118.193 255.0.0.0 UG 0 0 0 eth0 10.168.118.192 0.0.0.0 255.255.255.192 U 0 0 0 eth0 45.32.239.20 167.41.133.209 255.255.255.255 UGH 0 0 0 eth1 161.26.0.0 10.168.118.193 255.255.0.0 UG 0 0 0 eth0 167.41.133.208 0.0.0.0 255.255.255.240 U 0 0 0 eth1root@server:/home/user# I found two solutions, which worked on the first view, but they really don't work (and I don't know why).Adding route add default metric 10 gw $PPP_REMOTE $PPP_IFNAME in the up-script, or add defaultroute to the pptp configurationIn both cases, calling curl --interface ppp0 ifconfig.co as root works and returns the IP address of the VPN connection, but I cannot execute the command as any other non-root user. The command curl --interface eth1 ifconfig.co works fine as root or a normal user.
Enabling an Internet route through ppp0
Change the used loglevel in your NetworkManager.conf file[logging] This section controls NetworkManager's logging. Any settings here are overridden by the --log-level and --log-domains command-line options. level=<level> One of [ERR, WARN, INFO, DEBUG]. The ERR level logs only critical errors. WARN logs warnings that may reflect operation. INFO logs various informational messages that are useful for tracking state and operations. DEBUG enables verbose logging for debugging purposes. Subsequent levels also log all messages from earlier levels; thus setting the log level to INFO also logs error and warning messages.But note this part:This section controls NetworkManager's logging. Any settings here are overridden by the --log-level and --log-domains command-line options.
I'm running Arch Linux, and recently updated the whole system. Now I every time I connects to VPN with nmcli command, if it fails, I couldn't figure out the reason: NetworkManager[15967]: <info> VPN plugin state changed: starting (3) NetworkManager[15967]: <info> VPN connection 'XXX' (Connect) reply received. NetworkManager[15967]: <warn> /sys/devices/virtual/net/ppp0: couldn't determine device driver; ignoring... NetworkManager[15967]: <warn> VPN plugin failed: 1 NetworkManager[15967]: <warn> VPN plugin failed: 1 NetworkManager[15967]: <warn> VPN plugin failed: 1 NetworkManager[15967]: <info> VPN plugin state changed: stopped (6) NetworkManager[15967]: <info> VPN plugin state change reason: 0 NetworkManager[15967]: <warn> error disconnecting VPN: Could not process the request because no VPN connection was active.Prior to the upgrade, I can see error messages from pppd, e.g "You're already logged in bla bla", now every helpful message is gone. Any ideas? Why is the connection failed?
How do I know why NetworkManager failed to initiate the VPN connection?
ok , i found a solution , i made the vpn connections with pptpsetup tool , and after editing /etc/ppp/peers/* , i connected to the first vpn through pon command or pppd call and routing my traffic through this connection (ppp0) (route add default dev ppp0) after that i connected to the second vpn (pppd call) and routed again , problem solved! i also tried connecting to one vpn by NetworkManager and the second with pon (and vise-versa) but it didn't work. guide for pptpsetup : PPPTP setup
in windows you can simply create two pptp connections and after connecting to one of them, easily connect to the other one while maintaining the first. Is there any way to do this (cli or gui) in linux? I also found this resource, but found it rather unhelpful.
VPN tunneling through another VPN
Take out the .sh from the script name. You can test with: run-parts --test /etc/ppp/ip-up.dIf it does not shows up, it is because of permission/file naming.
My PPTP client is Ubuntu Desktop 14.04.2LTS. My PPTP Server is a Buffalo DD-WRT Firmware. If I establish my PPTP VPN connection (named Themiscyra): luis@PortatilHP:~$ sudo pon Themiscyra luis@PortatilHP:~$ sudo ifconfig eth0 Link encap:Ethernet direcciónHW 98:4b:e1:c7:b8:4c Direc. inet:192.168.11.2 Difus.:192.168.11.255 Másc:255.255.255.0 Dirección inet6: fe80::9a4b:e1ff:fec7:b84c/64 Alcance:Enlace ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST MTU:1500 Métrica:1 Paquetes RX:6091 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:4648 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:1000 Bytes RX:512969 (512.9 KB) TX bytes:449801 (449.8 KB)lo Link encap:Bucle local Direc. inet:127.0.0.1 Másc:255.0.0.0 Dirección inet6: ::1/128 Alcance:Anfitrión ACTIVO BUCLE FUNCIONANDO MTU:65536 Métrica:1 Paquetes RX:139 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:139 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:0 Bytes RX:10137 (10.1 KB) TX bytes:10137 (10.1 KB)ppp0 Link encap:Protocolo punto a punto Direc. inet:192.168.210.154 P-t-P:192.168.210.1 Másc:255.255.255.255 ACTIVO PUNTO A PUNTO FUNCIONANDO NOARP MULTICAST MTU:1446 Métrica:1 Paquetes RX:6 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:6 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:3 Bytes RX:72 (72.0 B) TX bytes:78 (78.0 B)wlan0 Link encap:Ethernet direcciónHW ec:55:f9:35:8a:98 ACTIVO DIFUSIÓN MULTICAST MTU:1500 Métrica:1 Paquetes RX:0 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:0 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:1000 Bytes RX:0 (0.0 B) TX bytes:0 (0.0 B)... the PPTP connection gets stablished as ppp0. There are no more PPTP connections defined: luis@PortatilHP:~$ sudo ls /etc/ppp/peers/ -la total 16 drwxr-s--- 2 root dip 4096 jun 8 21:59 . drwxr-xr-x 8 root root 4096 mar 12 22:37 .. -rw-r----- 1 root dip 1093 jul 23 2014 provider -rw-r--r-- 1 root dip 153 jun 8 21:59 ThemiscyraBut I have prepared a simple script to change the netmask for ppp0 to 255.255.255.0 : luis@PortatilHP:~$ ls -la /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh -rwxr-xr-x 1 root root 96 jun 8 23:04 /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh luis@PortatilHP:~$ more /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh #!/bin/sh ifconfig ppp0 netmask 255.255.255.0As can be seen, this script is not autoexecuted. So I need to start it manually: luis@PortatilHP:~$ sudo /etc/ppp/ip-up.d/Themiscyra-VPN-NetMask.sh luis@PortatilHP:~$ sudo ifconfig eth0 Link encap:Ethernet direcciónHW 98:4b:e1:c7:b8:4c Direc. inet:192.168.11.2 Difus.:192.168.11.255 Másc:255.255.255.0 Dirección inet6: fe80::9a4b:e1ff:fec7:b84c/64 Alcance:Enlace ACTIVO DIFUSIÓN FUNCIONANDO MULTICAST MTU:1500 Métrica:1 Paquetes RX:6398 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:4885 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:1000 Bytes RX:538500 (538.5 KB) TX bytes:475909 (475.9 KB)lo Link encap:Bucle local Direc. inet:127.0.0.1 Másc:255.0.0.0 Dirección inet6: ::1/128 Alcance:Anfitrión ACTIVO BUCLE FUNCIONANDO MTU:65536 Métrica:1 Paquetes RX:139 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:139 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:0 Bytes RX:10137 (10.1 KB) TX bytes:10137 (10.1 KB)ppp0 Link encap:Protocolo punto a punto Direc. inet:192.168.210.154 P-t-P:192.168.210.1 Másc:255.255.255.0 ACTIVO PUNTO A PUNTO FUNCIONANDO NOARP MULTICAST MTU:1446 Métrica:1 Paquetes RX:6 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:6 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:3 Bytes RX:72 (72.0 B) TX bytes:78 (78.0 B)wlan0 Link encap:Ethernet direcciónHW ec:55:f9:35:8a:98 ACTIVO DIFUSIÓN MULTICAST MTU:1500 Métrica:1 Paquetes RX:0 errores:0 perdidos:0 overruns:0 frame:0 Paquetes TX:0 errores:0 perdidos:0 overruns:0 carrier:0 colisiones:0 long.colaTX:1000 Bytes RX:0 (0.0 B) TX bytes:0 (0.0 B)What is going on here? The plog command seems not to show any relevant info: luis@PortatilHP:~$ sudo plog Jun 8 23:12:05 PortatilHP pppd[3675]: CHAP authentication succeeded Jun 8 23:12:05 PortatilHP pppd[3675]: MPPE 128-bit stateless compression enabled Jun 8 23:12:05 PortatilHP pppd[3675]: local IP address 192.168.210.154 Jun 8 23:12:05 PortatilHP pppd[3675]: remote IP address 192.168.210.1... so, knowing about some log reporting about /etc/ppp/ip-up.d/ scripts info could be very useful for me in the future. Does such thing exists? It seems there is nothing at /var/log.
VPN: Script at /etc/ppp/ip-up.d/ not autoexecuting on PPTP connection established
Check this: http://pptpclient.sourceforge.net/howto-diagnosis.phtml#ip_loop. NM (or pppd) is creating an additional, wrong, default route (even if nodefaultroute is being passed as parameter). route del won't delete it. I got around it by telling NM the connection would be shared with other users. It is most likely a bug, but this solved the problem for a while.
After update to Fedora 25 one of my PPTP connections strangely works. Remote net is not available. It is connected, successfully get remote net IP address. While connected nothing is available in remote net, but internet works fine. After a few minutes connection breaks by itself. I've noticed strange thing, while pptp connection is on there are too much TX packets transferred: ppp0: flags=4305<UP,POINTOPOINT,RUNNING,NOARP,MULTICAST> mtu 1400 inet 192.168.1.96 netmask 255.255.255.255 destination ___.__.___.___ ppp txqueuelen 3 (Point-to-Point Protocol) RX packets 10 bytes 172 (172.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 9864041 bytes 5842982146 (5.4 GiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0In a 10-15 seconds it shows up to 5.4 GiB of packets. It grows very fast. The same if firewalld is disabled. I'm using Network-Manager to connect to pptp. [root@c0rp ~]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch Distributor ID: Fedora Description: Fedora release 25 (Twenty Five) Release: 25 Codename: TwentyFive [root@c0rp ~]# uname -a Linux c0rp 4.10.8-200.fc25.x86_64 #1 SMP Fri Mar 31 13:20:22 UTC 2017 x86_64 x86_64 x86_64 GNU/LinuxCan someone help me to investigate the problem, pleaseUpdate after solution was provided I found that newly created route points to itself, using route command. Check exactly after pptp connected: xxx.xxx.xxx.xxx 0.0.0.0 255.255.255.255 UH 50 0 0 ppp0What I did is:Remove delete assigned address from network device Add back the assigned address along with a replacement peer addressEverything exactly as it was pointed in the link.Finally I add this two steps into dispatcher.d script: #!/bin/bash INTERFACE=$1 ACTION=$2 SSID="Your vpn connection name in Network Manager"if [[ $CONNECTION_ID == "$SSID" ]]; then if [[ $ACTION = "vpn-up" ]]; then IP4_ADDRESS=$(ifconfig "$1" | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1') ip addr del "$IP4_ADDRESS" dev $INTERFACE ip addr add "$IP4_ADDRESS" peer 192.168.1.9/24 dev $INTERFACE fi fiI put this script into /etc/NetworkManager/dispatcher.d
Fedora 25, pptp connects but not working, too many transferred packets
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. Rule #1 has no hit (0 pkts). It means traffic is being blocked by earlier rules. I suggest you do a rule cleanup, and re-add rules making sure that you do not duplicate.
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). The server has a local address of 192.168.0.1 and the client receives 192.168.0.100, as per defaults. The iptables below show some other address ranges that were used for testing. I'm pretty sure it's an iptables issue but I don't have experience tracing these kind of issues by just looking at the rules list. # sysctl -p net.ipv4.ip_forward = 1 net.netfilter.nf_conntrack_helper = 1# iptables -nvL -t nat --line-number Chain PREROUTING (policy ACCEPT 239K packets, 23M bytes) num pkts bytes target prot opt in out source destination 1 252K 25M PREROUTING_direct all -- * * 0.0.0.0/0 0.0.0.0/0 2 252K 25M PREROUTING_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0Chain INPUT (policy ACCEPT 50342 packets, 2729K bytes) num pkts bytes target prot opt in out source destinationChain OUTPUT (policy ACCEPT 62252 packets, 4500K bytes) num pkts bytes target prot opt in out source destination 1 62476 4516K OUTPUT_direct all -- * * 0.0.0.0/0 0.0.0.0/0Chain POSTROUTING (policy ACCEPT 21854 packets, 1580K bytes) num pkts bytes target prot opt in out source destination 1 40409 2921K MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0 2 70 4886 MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0 3 5 325 MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0 4 22005 1590K POSTROUTING_direct all -- * * 0.0.0.0/0 0.0.0.0/0 5 22005 1590K POSTROUTING_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0 6 6 432 MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0 7 0 0 MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0 8 0 0 MASQUERADE all -- * eth0 0.0.0.0/0 0.0.0.0/0Chain OUTPUT_direct (1 references) num pkts bytes target prot opt in out source destinationChain POSTROUTING_ZONES (1 references) num pkts bytes target prot opt in out source destination 1 0 0 POST_public all -- * * 0.0.0.0/0 192.168.0.0/24 [goto] 2 22005 1590K POST_public all -- * + 0.0.0.0/0 0.0.0.0/0 [goto]Chain POSTROUTING_direct (1 references) num pkts bytes target prot opt in out source destinationChain POST_public (2 references) num pkts bytes target prot opt in out source destination 1 22005 1590K POST_public_pre all -- * * 0.0.0.0/0 0.0.0.0/0 2 22005 1590K POST_public_log all -- * * 0.0.0.0/0 0.0.0.0/0 3 22005 1590K POST_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0 4 22005 1590K POST_public_allow all -- * * 0.0.0.0/0 0.0.0.0/0 5 22005 1590K POST_public_post all -- * * 0.0.0.0/0 0.0.0.0/0Chain POST_public_allow (1 references) num pkts bytes target prot opt in out source destinationChain POST_public_deny (1 references) num pkts bytes target prot opt in out source destinationChain POST_public_log (1 references) num pkts bytes target prot opt in out source destinationChain POST_public_post (1 references) num pkts bytes target prot opt in out source destinationChain POST_public_pre (1 references) num pkts bytes target prot opt in out source destinationChain PREROUTING_ZONES (1 references) num pkts bytes target prot opt in out source destination 1 11025 842K PRE_public all -- * * 192.168.0.0/24 0.0.0.0/0 [goto] 2 241K 24M PRE_public all -- + * 0.0.0.0/0 0.0.0.0/0 [goto]Chain PREROUTING_direct (1 references) num pkts bytes target prot opt in out source destinationChain PRE_public (2 references) num pkts bytes target prot opt in out source destination 1 252K 25M PRE_public_pre all -- * * 0.0.0.0/0 0.0.0.0/0 2 252K 25M PRE_public_log all -- * * 0.0.0.0/0 0.0.0.0/0 3 252K 25M PRE_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0 4 252K 25M PRE_public_allow all -- * * 0.0.0.0/0 0.0.0.0/0 5 252K 25M PRE_public_post all -- * * 0.0.0.0/0 0.0.0.0/0Chain PRE_public_allow (1 references) num pkts bytes target prot opt in out source destinationChain PRE_public_deny (1 references) num pkts bytes target prot opt in out source destinationChain PRE_public_log (1 references) num pkts bytes target prot opt in out source destinationChain PRE_public_post (1 references) num pkts bytes target prot opt in out source destinationChain PRE_public_pre (1 references) num pkts bytes target prot opt in out source destination# iptables -nvL --line-number Chain INPUT (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 5673 557K ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0 2 5071 511K ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0 3 83 4400 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723 state NEW 4 1532 141K ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0 5 1 52 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:1723 state NEW 6 1759 163K ACCEPT 47 -- eth0 * 0.0.0.0/0 0.0.0.0/0 7 555K 94M ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED,DNAT 8 21994 1589K ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 9 110K 6423K INPUT_direct all -- * * 0.0.0.0/0 0.0.0.0/0 10 72059 4171K INPUT_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0 11 8933 364K DROP all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID 12 11808 1026K REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 13 0 0 ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0 14 0 0 ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0 15 0 0 ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0Chain FORWARD (policy ACCEPT 0 packets, 0 bytes) num pkts bytes target prot opt in out source destination 1 2072 108K TCPMSS tcp -- * * 192.168.0.0/24 0.0.0.0/0 tcp flags:0x06/0x02 TCPMSS clamp to PMTU 2 0 0 TCPMSS tcp -- * * 10.0.0.0/24 0.0.0.0/0 tcp flags:0x06/0x02 TCPMSS clamp to PMTU 3 3739 194K TCPMSS tcp -- * * 192.168.0.0/24 0.0.0.0/0 tcp flags:0x06/0x02 TCPMSS clamp to PMTU 4 0 0 TCPMSS tcp -- * * 192.168.1.0/24 0.0.0.0/0 tcp flags:0x06/0x02 TCPMSS clamp to PMTU 5 0 0 ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0 6 80 5808 ACCEPT all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate RELATED,ESTABLISHED,DNAT 7 0 0 ACCEPT all -- lo * 0.0.0.0/0 0.0.0.0/0 8 8862 510K FORWARD_direct all -- * * 0.0.0.0/0 0.0.0.0/0 9 8862 510K FORWARD_IN_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0 10 8819 507K FORWARD_OUT_ZONES all -- * * 0.0.0.0/0 0.0.0.0/0 11 0 0 DROP all -- * * 0.0.0.0/0 0.0.0.0/0 ctstate INVALID 12 8819 507K REJECT all -- * * 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited 13 0 0 TCPMSS tcp -- * * 192.168.0.0/24 0.0.0.0/0 tcp flags:0x17/0x02 TCPMSS set 1356 14 0 0 ACCEPT all -- ppp+ eth0 0.0.0.0/0 0.0.0.0/0 15 0 0 ACCEPT all -- eth0 ppp+ 0.0.0.0/0 0.0.0.0/0 16 0 0 ACCEPT all -- ppp+ * 0.0.0.0/0 0.0.0.0/0Chain OUTPUT (policy ACCEPT 603K packets, 125M bytes) num pkts bytes target prot opt in out source destination 1 8423 599K ACCEPT 47 -- * eth0 0.0.0.0/0 0.0.0.0/0 2 43988 3795K ACCEPT all -- * lo 0.0.0.0/0 0.0.0.0/0 3 627K 136M OUTPUT_direct all -- * * 0.0.0.0/0 0.0.0.0/0 4 0 0 ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0 5 0 0 ACCEPT 47 -- * * 0.0.0.0/0 0.0.0.0/0Chain FORWARD_IN_ZONES (1 references) num pkts bytes target prot opt in out source destination 1 8862 510K FWDI_public all -- * * 192.168.0.0/24 0.0.0.0/0 [goto] 2 0 0 FWDI_public all -- + * 0.0.0.0/0 0.0.0.0/0 [goto]Chain FORWARD_OUT_ZONES (1 references) num pkts bytes target prot opt in out source destination 1 0 0 FWDO_public all -- * * 0.0.0.0/0 192.168.0.0/24 [goto] 2 8819 507K FWDO_public all -- * + 0.0.0.0/0 0.0.0.0/0 [goto]Chain FORWARD_direct (1 references) num pkts bytes target prot opt in out source destinationChain FWDI_public (2 references) num pkts bytes target prot opt in out source destination 1 8862 510K FWDI_public_pre all -- * * 0.0.0.0/0 0.0.0.0/0 2 8862 510K FWDI_public_log all -- * * 0.0.0.0/0 0.0.0.0/0 3 8862 510K FWDI_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0 4 8862 510K FWDI_public_allow all -- * * 0.0.0.0/0 0.0.0.0/0 5 8862 510K FWDI_public_post all -- * * 0.0.0.0/0 0.0.0.0/0 6 43 3348 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0Chain FWDI_public_allow (1 references) num pkts bytes target prot opt in out source destinationChain FWDI_public_deny (1 references) num pkts bytes target prot opt in out source destinationChain FWDI_public_log (1 references) num pkts bytes target prot opt in out source destinationChain FWDI_public_post (1 references) num pkts bytes target prot opt in out source destinationChain FWDI_public_pre (1 references) num pkts bytes target prot opt in out source destinationChain FWDO_public (2 references) num pkts bytes target prot opt in out source destination 1 8819 507K FWDO_public_pre all -- * * 0.0.0.0/0 0.0.0.0/0 2 8819 507K FWDO_public_log all -- * * 0.0.0.0/0 0.0.0.0/0 3 8819 507K FWDO_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0 4 8819 507K FWDO_public_allow all -- * * 0.0.0.0/0 0.0.0.0/0 5 8819 507K FWDO_public_post all -- * * 0.0.0.0/0 0.0.0.0/0Chain FWDO_public_allow (1 references) num pkts bytes target prot opt in out source destinationChain FWDO_public_deny (1 references) num pkts bytes target prot opt in out source destinationChain FWDO_public_log (1 references) num pkts bytes target prot opt in out source destinationChain FWDO_public_post (1 references) num pkts bytes target prot opt in out source destinationChain FWDO_public_pre (1 references) num pkts bytes target prot opt in out source destinationChain INPUT_ZONES (1 references) num pkts bytes target prot opt in out source destination 1 1214 114K IN_public all -- * * 192.168.0.0/24 0.0.0.0/0 [goto] 2 70845 4058K IN_public all -- + * 0.0.0.0/0 0.0.0.0/0 [goto]Chain INPUT_direct (1 references) num pkts bytes target prot opt in out source destination 1 37532 2252K REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 25,465,587,143,993,110,995 match-set f2b-postfix-sasl src reject-with icmp-port-unreachable 2 1 60 REJECT tcp -- * * 0.0.0.0/0 0.0.0.0/0 multiport dports 22 match-set f2b-sshd src reject-with icmp-port-unreachableChain IN_public (2 references) num pkts bytes target prot opt in out source destination 1 72059 4171K IN_public_pre all -- * * 0.0.0.0/0 0.0.0.0/0 2 72059 4171K IN_public_log all -- * * 0.0.0.0/0 0.0.0.0/0 3 72059 4171K IN_public_deny all -- * * 0.0.0.0/0 0.0.0.0/0 4 72059 4171K IN_public_allow all -- * * 0.0.0.0/0 0.0.0.0/0 5 20855 1397K IN_public_post all -- * * 0.0.0.0/0 0.0.0.0/0 6 114 6638 ACCEPT icmp -- * * 0.0.0.0/0 0.0.0.0/0Chain IN_public_allow (1 references) num pkts bytes target prot opt in out source destination 1 2000 84664 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:443 ctstate NEW,UNTRACKED 2 21 868 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:21 ctstate NEW,UNTRACKED 3 27 1460 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:993 ctstate NEW,UNTRACKED 4 12 496 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:465 ctstate NEW,UNTRACKED 5 676 36856 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:22 ctstate NEW,UNTRACKED 6 11957 717K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:25 ctstate NEW,UNTRACKED 7 186 10756 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:110 ctstate NEW,UNTRACKED 8 4329 238K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:80 ctstate NEW,UNTRACKED 9 25 1368 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:995 ctstate NEW,UNTRACKED 10 21 1088 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:143 ctstate NEW,UNTRACKED 11 3 120 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:20 ctstate NEW,UNTRACKED 12 114 5008 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpts:10000:10100 ctstate NEW,UNTRACKED 13 26 1376 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:20000 ctstate NEW,UNTRACKED 14 31 2022 ACCEPT udp -- * * 0.0.0.0/0 0.0.0.0/0 udp dpt:53 ctstate NEW,UNTRACKED 15 7 288 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:53 ctstate NEW,UNTRACKED 16 31049 1629K ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpts:1025:65535 ctstate NEW,UNTRACKED 17 0 0 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:2222 ctstate NEW,UNTRACKED 18 720 43028 ACCEPT tcp -- * * 0.0.0.0/0 0.0.0.0/0 tcp dpt:587 ctstate NEW,UNTRACKEDChain IN_public_deny (1 references) num pkts bytes target prot opt in out source destinationChain IN_public_log (1 references) num pkts bytes target prot opt in out source destinationChain IN_public_post (1 references) num pkts bytes target prot opt in out source destinationChain IN_public_pre (1 references) num pkts bytes target prot opt in out source destinationChain OUTPUT_direct (1 references) num pkts bytes target prot opt in out source destination
PPTP VPN Ubuntu no web access
Actually, I realized that the PPTP was disabled on MikroTik v6.25, i.e. IP address 172.16.100.2, that's why I couldn't connect to the VPN server. After enabling the PPTP on MikroTik, I'm able to connect to the server like this: me@linux-box:~> sudo pppd call TUNNEL debug nodetach using channel 15 Using interface ppp0 Connect: ppp0 <--> /dev/pts/5 sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa905bd9b> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa905bd9b> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa905bd9b> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa905bd9b> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa905bd9b> <pcomp> <accomp>] sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xa905bd9b> <pcomp> <accomp>]
I'm trying to setup a VPN connection on OpenSUSE Leap 42.2, with the following command: me@linux-box:~> sudo pptpsetup --create TUNNEL --server 172.16.100.2 --username 444182 --password 255553 --startBut I'm receiving the following error message: Using interface ppp0 Connect: ppp0 <--> /dev/pts/5 anon warn[open_inetsock:pptp_callmgr.c:329]: connect: Connection refused anon fatal[callmgr_main:pptp_callmgr.c:127]: Could not open control connection to 172.16.100.2 anon fatal[open_callmgr:pptp.c:479]: Call manager exited with error 256 Script pptp 172.16.100.2 --nolaunchpppd finished (pid 17988), status = 0x1 Modem hangup Connection terminated.Also, when trying to start the VPN with: pppd call TUNNEL debug nodetachI receive the same error message. Also, when I turn off my firewall, I receive the same error message. I wonder if anybody knows how to resolve it.
Start a VPN connection with PPTP protocol on command line [closed]
Your Issue I would recommend a separate routing table for this, since I assume the traffic arriving at 192.168.0.2 has a source address of 35.100.100.35. The issue you're having is that 35.100.100.35 isn't listed in your routing table, so the default is being used. You might be able to get away with something as simple as: ip route add 35.0.0.0/8 via 192.168.0.1 dev ppp0So that when your machine tries to respond to a 35 address, it does so on the ppp0 interface. The more robust/elaborate version follows. NOTE: You should reboot your machine to clear out any temporary changes you've made to your routing table.Routing Rules A simple enough routing rule is to have any traffic that is destined to or from a specific IP or subnet to use a different routing table: ip rule add from [interface ip]/[netmask] tab [table number] priority [priority] ip rule add to [interface ip]/[netmask] tab [table number] priority [priority]In this case you're concerned about traffic arriving at 192.168.0.2 (your ppp0 device IP). You'll need to create a new routing table by adding to the file: /etc/iproute2/rt_tables. The syntax is [table number] [table name]. I normally use the interface name as the table name, keep things simple. echo "168 ppp0" >> /etc/iproute2/rt_tables ip rule add from 192.168.0.2/32 tab 168 priority 101 ip rule add to 192.168.0.2/32 tab 168 priority 101This should cause all traffic addressed to 192.168.0.2 to match routing table 168, as well as any traffic that is in response to traffic in that table.Using New Routing Tables Now we've directed traffic to that routing table 168, but it would be empty, only need to add a default route to it now. ip route add default via 192.168.0.1 dev ppp0 table 168This adds a default route to table 168, which is simply to say use interface ppp0.What It Looks Like Your routing tables in the end should probably look like this: # ip route show default dev eth0 proto static metric 1024 192.168.1.0/24 dev eth0 proto kernel scope link src 192.168.1.20 192.168.0.0/24 dev ppp0 proto kernel scope link src 192.168.0.2This is your standard routing table, the table normally used for traffic. As for the routes here: the default as you've probably originally defined, and the second two are inferred based on the IP address of your interfaces. # ip rule show 0: from all lookup local 101: from 192.168.0.2 lookup ppp0 101: from all to 192.168.0.2 lookup ppp0This lists your routing rules, format is "[priority]: [rule] lookup [table]". This example states that normally, use the local routing table. If the traffic is to or from 192.168.0.2 use the routing table named ppp0. # ip route show table ppp0 default via 192.168.0.1 dev ppp0This shows the routing table named ppp0, which should just send all traffic out ppp0.End Result The end result of this is that when traffic is heading to or from the IP of your ppp0 interface, it will use the routing table called ppp0. The routing table ppp0 just send all traffic out device ppp0.
I used this guide to connect to my VPN server (pptp) which is the only one guide that worked from many tutorials. After connecting to the VPN server the route table looks like below and sometimes it's only the last 2 lines (very random I'm sure there's a reason). Destination Gateway Genmask Flags Metric Ref Use Iface 0.0.0.0 192.168.0.1 255.255.255.255 UGH 0 0 0 ppp0 192.168.0.1 0.0.0.0 255.255.255.255 UH 0 0 0 ppp0 0.0.0.0 192.168.1.1 0.0.0.0 UG 0 0 0 eth0My set up: (IPs changed in example to make it simple)Local computer (centos) running on 192.168.1.20 This connects to external VPN (ubuntu) on 35.100.100.35 (internet) with internal VPN local IP 192.168.0.1 When centos is connected, interface ppp0 gets added with the IP 192.168.0.2However, I need all traffic from 192.168.0.2 to be routed via 192.168.0.1 (vpn server). Currently it uses local internet. I've tried so many variations and cannot get it right. route add default ppp0 used to work but with the route tables destroyed it's not working anymore. What should the route table look like?
route table with eth0 and ppp0 broken
The answer is to setup a default route. I do this: sudo ip route add default via 192.168.1.1 metric 40where: 192.168.1.1 = local gateway (not VPN gateway) metric 40 = Some metric that is lower than your existing default routeIn simple steps:Without being on VPN use ip route and note the line beginning with default (proto, dhcp aren't important) Connect to VPN Use ip route add, then append the line you noted before, but make the metric lower than anything that may currently exist.With this setup, I can access all intranet tools that would normally be available via a VPN, while diverting all internet traffic away from it.Edit: I saw your updated routing table. 192.168.1.1 is probably the route you want, and metric 40 will work because it's lower than the default VPN route which is 50.
I am connected to a VPN network through a pptp connection. The target network does not provide Internet access, thus I can't connect to it. How should I route my Internet traffic through my existing connection? Below, are my existing routes Destination Gateway Genmask Flags Metric Ref Use Iface default 0.0.0.0 0.0.0.0 U 50 0 0 ppp0 default _gateway 0.0.0.0 UG 20600 0 0 wlp4s0 link-local 0.0.0.0 255.255.0.0 U 1000 0 0 docker0 172.18.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0 192.168.1.0 0.0.0.0 255.255.255.0 U 600 0 0 wlp4s0 _gateway 0.0.0.0 255.255.255.255 UH 600 0 0 wlp4s0 192.168.116.42 0.0.0.0 255.255.255.255 UH 50 0 0 ppp0 212.80.25.88 _gateway 255.255.255.255 UGH 0 0 0 wlp4s0 212.80.25.88 _gateway 255.255.255.255 UGH 600 0 0 wlp4s0
Access internet when connected to VPN
This turned out to be a remnant config from a ProtonVPN uninstall. Here's the steps I followed to fix it (provided by ProtonVPN support): - Download the latest ProtonVPN application version through the following link: https://protonvpn.com/download/ProtonVPN.dmg - Install the application, login, establish a connection to a ProtonVPN server, disconnect - Navigate to macOS System preferences -> Network -> select the ProtonVPN profile and then click on the "-" minus sign to remove it - Download the uninstaller: https://freemacsoft.net/appcleaner/ - Install and open it - Find ProtonVPN application on your device - Drag and drop ProtonVPN application to the app cleaner - Once it is deleted, clear your trash binContinue with the following:- Navigate to your WiFi settings and remove/forget the Wi-Fi network you are connected to - Reboot your device - Select the WiFi network and enter the authentication information again - Check if the issue persists and inform us of the results
Any clue what is causing the ipsec0 interface to establish PTP and then adding a default route to the PTP? It's borking my routing and I can't seem to find the culprit I have no VPN profiles enabled, no VPN client running. Recently removed ProtonVPN. TunnelBlick installed but not running. This seems to happen each time I connect to a WiFi AP. ifconfig -a -vv ipsec0 -- Note the agent domain desc:"VPN: ProtonVPN" [App Cleaner used to remove ProtonVPN several times] ipsec0: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1400 index 17 eflags=5002080<TXSTART,NOAUTOIPV6LL,ECN_ENABLE,CHANNEL_DRV> xflags=4<NOAUTONX> options=6403<RXCSUM,TXCSUM,CHANNEL_IO,PARTIAL_CSUM,ZEROINVERT_CSUM> inet 10.6.5.206 --> 10.6.5.206 netmask 0xff000000 netif: E22A3DA9-EA52-41DE-9C1F-5F4598DEF26F flowswitch: E79F3C2B-56E4-4816-B390-7DB240E9664E type: 0x1 family: 18 subfamily: 0 functional type: wifi agent domain:Skywalk type:NetIf flags:0x8443 desc:"Userspace Networking" agent domain:Skywalk type:FlowSwitch flags:0x4403 desc:"Userspace Networking" agent domain:NetworkExtension type:VPN flags:0xf desc:"VPN: ProtonVPN" link quality: -1 (unknown) state availability: 0 (true) scheduler: FQ_CODEL effective interface: en0 qosmarking enabled: no mode: none low power mode: disabled multi layer packet logging (mpklog): disablednetstat -nr Routing tablesInternet: Destination Gateway Flags Netif Expire default link#17 UCS ipsec0 default 192.168.16.1 UGScI en0 1.2.3.4 link#17 UHW3I ipsec0 29 3.82.239.106 link#17 UHWIi ipsec0 3.228.164.50 link#17 UHWIi ipsec0 10.6.5.206 10.6.5.206 UH ipsec0 10.6.9.1 link#17 UHWIi ipsec0 13.107.136.9 link#17 UHWIi ipsec0 17.57.144.20 link#17 UHWIi ipsec0 17.248.129.42 link#17 UHWIi ipsec0 17.248.129.106 link#17 UHWIi ipsec0 17.248.188.11 link#17 UHWIi ipsec0 18.204.158.139 link#17 UHWIi ipsec0 23.36.192.188 link#17 UHWIi ipsec0 23.36.193.63 link#17 UHWIi ipsec0 34.192.122.34 link#17 UHWIi ipsec0 34.202.13.87 link#17 UHWIi ipsec0 34.204.122.179 link#17 UHWIi ipsec0 34.214.40.205 link#17 UHWIi ipsec0 34.224.73.75 link#17 UHWIi ipsec0 34.228.110.91 link#17 UHWIi ipsec0 34.235.232.2 link#17 UHWIi ipsec0 50.19.197.254 link#17 UHWIi ipsec0 52.2.223.38 link#17 UHWIi ipsec0 52.2.231.4 link#17 UHWIi ipsec0 52.38.182.237 link#17 UHWIi ipsec0 52.96.36.82 link#17 UHW3I ipsec0 29 52.96.39.162 link#17 UHWIi ipsec0 52.113.194.132 link#17 UHWIi ipsec0 52.114.88.28 link#17 UHW3I ipsec0 35 52.114.132.22 link#17 UHWIi ipsec0 52.114.132.38 link#17 UHWIi ipsec0 52.114.133.12 link#17 UHWIi ipsec0 52.114.142.157 link#17 UHWIi ipsec0 52.204.83.172 link#17 UHWIi ipsec0 54.84.147.205 link#17 UHW3I ipsec0 33 127 127.0.0.1 UCS lo0 127.0.0.1 127.0.0.1 UH lo0 169.254 link#6 UCS en0 ! 172.16.215/24 link#19 UC vmnet8 ! 172.16.215.255 ff:ff:ff:ff:ff:ff UHLWbI vmnet8 ! 172.83.43.134 192.168.16.1 UGHS en0 192.168.16/22 link#6 UCS en0 ! 192.168.16.1/32 link#6 UCS en0 ! 192.168.16.1 f0:9f:c2:1a:63:cf UHLWIir en0 1187 192.168.16.66 9c:30:5b:d3:77:2f UHLWI en0 1138 192.168.16.69 0:b3:62:34:7b:de UHLWI en0 877 192.168.16.124 c4:61:8b:4c:ec:5f UHLWI en0 1057 192.168.16.133 c8:3c:85:a0:2f:b7 UHLWI en0 814 192.168.16.155 2c:be:8:bb:5e:c3 UHLWI en0 825 192.168.16.201 80:82:23:66:84:4 UHLWI en0 877 192.168.16.219 0:15:99:d7:f6:5a UHLWI en0 1185 192.168.16.225 c:51:1:c7:a4:1e UHLWI en0 856 192.168.16.234/32 link#6 UCS en0 ! 192.168.16.236 0:80:92:cb:ab:bf UHLWI en0 1180 192.168.17.8 6c:8d:c1:3f:b5:2d UHLWI en0 1079 192.168.17.16 d8:1c:79:ea:8e:2b UHLWI en0 911 192.168.17.65 90:e1:7b:d7:75:23 UHLWI en0 1007 192.168.17.67 34:2:86:87:d1:b UHLWI en0 1069 192.168.17.85 d8:1c:79:ca:6b:bd UHLWI en0 1176 192.168.17.173 14:20:5e:85:36:2 UHLWI en0 1031 192.168.17.221 38:b1:db:e3:40:3b UHLWIi en0 1165 192.168.17.222 30:d1:6b:10:93:c0 UHLWI en0 1079 192.168.18.6 c0:a6:0:7:ee:c9 UHLWI en0 857 192.168.18.69 8c:85:90:11:5c:90 UHLWI en0 1094 192.168.18.79 40:bc:60:1e:2:d5 UHLWI en0 967 192.168.18.124 7c:a1:ae:8:29:8f UHLWI en0 1066 192.168.18.161 34:42:62:7d:a7:d0 UHLWI en0 1124 192.168.18.189 14:10:9f:e9:31:a2 UHLWIi en0 1163 192.168.18.239 3c:2e:ff:1f:94:ca UHLWI en0 1138 192.168.19.2 58:6b:14:6:b5:9e UHLWI en0 931 192.168.19.22 54:33:cb:51:60:53 UHLWIi en0 813 192.168.19.76 80:c:67:3f:2c:e1 UHLWI en0 988 192.168.19.83 b0:ca:68:9c:83:3c UHLWI en0 924 192.168.19.143 b8:41:a4:54:c0:8a UHLWIi en0 874 192.168.19.255 ff:ff:ff:ff:ff:ff UHLWbI en0 ! 192.168.74 link#18 UC vmnet1 ! 192.168.74.255 ff:ff:ff:ff:ff:ff UHLWbI vmnet1 ! 224.0.0/4 link#17 UmCS ipsec0 224.0.0/4 link#6 UmCSI en0 ! 224.0.0.251 link#17 UHmW3I ipsec0 33 255.255.255.255/32 link#17 UCS ipsec0 255.255.255.255/32 link#6 UCSI en0 !Internet6: Destination Gateway Flags Netif Expire default fe80::%utun0 UGcI utun0 default fe80::%utun1 UGcI utun1 default fe80::%utun2 UGcI utun2 default fe80::%utun3 UGcI utun3 ::1 ::1 UHL lo0 fe80::%lo0/64 fe80::1%lo0 UcI lo0 fe80::1%lo0 link#1 UHLI lo0 fe80::%en10/64 link#4 UCI en10 fe80::aede:48ff:fe00:1122%en10 ac:de:48:0:11:22 UHLI lo0 fe80::aede:48ff:fe33:4455%en10 ac:de:48:33:44:55 UHLWIi en10 fe80::%en0/64 link#6 UCI en0 fe80::3:aea3:bd6f:3c20%en0 78:31:c1:c7:8a:ac UHLWI en0 fe80::45:ff77:829e:1285%en0 8c:85:90:98:cd:34 UHLWI en0 fe80::6d:c188:a11c:8f03%en0 9c:20:7b:de:7:a7 UHLWI en0 fe80::4cb:eb4c:daae:2b54%en0 b8:17:c2:c1:77:3a UHLWI en0 fe80::4d1:99e4:6833:564%en0 a4:83:e7:5e:75:e1 UHLWI en0 fe80::8e0:d15f:bde0:dc04%en0 98:1:a7:a4:a6:1b UHLWI en0 fe80::8f6:451f:1b75:721e%en0 f8:ff:c2:2e:ca:73 UHLWI en0 fe80::ca8:73fd:44fe:228a%en0 f8:ff:c2:44:e9:44 UHLI lo0 fe80::cf5:61:515f:c450%en0 10:94:bb:ed:2c:18 UHLWI en0 fe80::108b:8810:1b67:3c89%en0 8c:85:90:11:5c:90 UHLWI en0 fe80::10b4:36dc:d9c9:990f%en0 88:e9:fe:5c:21:19 UHLWI en0 fe80::1438:8686:40a6:4389%en0 b0:34:95:3d:7a:59 UHLWI en0 fe80::1493:6a8f:4a22:4454%en0 68:db:ca:9e:83:95 UHLWI en0 fe80::14a6:911:68f6:a4b8%en0 38:f9:d3:5a:8d:5b UHLWI en0 fe80::180f:3b62:489b:7928%en0 38:f9:d3:b6:32:59 UHLWI en0 fe80::18bc:cdbc:550:64e0%en0 6c:8d:c1:3f:b5:2d UHLWI en0 fe80::18ee:81f3:88fd:51d9%en0 a4:83:e7:83:f4:69 UHLWI en0 fe80::1cdb:e916:7bf8:8d4f%en0 38:f9:d3:cd:a0:28 UHLWI en0 fe80::%awdl0/64 link#8 UCI awdl0 fe80::6c52:f6ff:fe27:30de%awdl0 6e:52:f6:27:30:de UHLI lo0 fe80::%llw0/64 link#9 UCI llw0 fe80::6c52:f6ff:fe27:30de%llw0 6e:52:f6:27:30:de UHLI lo0 fe80::%utun0/64 fe80::ef8d:39b7:d0a7:bcff%utun0 UcI utun0 fe80::ef8d:39b7:d0a7:bcff%utun0 link#15 UHLI lo0 fe80::%utun1/64 fe80::f855:da2f:9165:598b%utun1 UcI utun1 fe80::f855:da2f:9165:598b%utun1 link#16 UHLI lo0 fe80::%utun2/64 fe80::c8b3:a4f3:ff43:d729%utun2 UcI utun2 fe80::c8b3:a4f3:ff43:d729%utun2 link#20 UHLI lo0 fe80::%utun3/64 fe80::8a6d:ce1a:3267:fdcb%utun3 UcI utun3 fe80::8a6d:ce1a:3267:fdcb%utun3 link#21 UHLI lo0 ff01::%lo0/32 ::1 UmCI lo0 ff01::%en10/32 link#4 UmCI en10 ff01::%en0/32 link#6 UmCI en0 ff01::%awdl0/32 link#8 UmCI awdl0 ff01::%llw0/32 link#9 UmCI llw0 ff01::%utun0/32 fe80::ef8d:39b7:d0a7:bcff%utun0 UmCI utun0 ff01::%utun1/32 fe80::f855:da2f:9165:598b%utun1 UmCI utun1 ff01::%utun2/32 fe80::c8b3:a4f3:ff43:d729%utun2 UmCI utun2 ff01::%utun3/32 fe80::8a6d:ce1a:3267:fdcb%utun3 UmCI utun3 ff02::%lo0/32 ::1 UmCI lo0 ff02::%en10/32 link#4 UmCI en10 ff02::%en0/32 link#6 UmCI en0 ff02::%awdl0/32 link#8 UmCI awdl0 ff02::%llw0/32 link#9 UmCI llw0 ff02::%utun0/32 fe80::ef8d:39b7:d0a7:bcff%utun0 UmCI utun0 ff02::%utun1/32 fe80::f855:da2f:9165:598b%utun1 UmCI utun1 ff02::%utun2/32 fe80::c8b3:a4f3:ff43:d729%utun2 UmCI utun2 ff02::%utun3/32 fe80::8a6d:ce1a:3267:fdcb%utun3 UmCI utun3
Mystery Interface and Routes on ipsec0, Catalina OSX
One thing that can cause this is having multiple clients connected using the same certificate- the OpenVPN server sees them as the same client and so assigns them the same IP address. If this is the case, you can make a unique certificate for each client, or add the duplicate-cn option to your options on the server, or check "Duplicate Connections" on the OpenVPN GUI options.
I have an OpenVPN server running, clients can connect to it and access internet, but all of the clients get 10.8.0.6 ip address, so they can't ping each other. I'm not sure, but I think that the issue might be in the routing on the server. The defaults that I have there are: route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface default 138.68.64.1 0.0.0.0 UG 0 0 0 eth0 10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0 10.8.0.2 * 255.255.255.255 UH 0 0 0 tun0 10.19.0.0 * 255.255.0.0 U 0 0 0 eth0 138.68.64.0 * 255.255.240.0 U 0 0 0 eth0iptables -vL Chain INPUT (policy DROP 14729 packets, 733K bytes) pkts bytes target prot opt in out source destination 3927K 786M ufw-before-logging-input all -- any any anywhere anywhere 3927K 786M ufw-before-input all -- any any anywhere anywhere 155K 7897K ufw-after-input all -- any any anywhere anywhere 155K 7876K ufw-after-logging-input all -- any any anywhere anywhere 155K 7876K ufw-reject-input all -- any any anywhere anywhere 155K 7876K ufw-track-input all -- any any anywhere anywhere 1 40 ACCEPT tcp -- eth0 any anywhere anywhere tcp dpt:ircdChain FORWARD (policy ACCEPT 33404 packets, 14M bytes) pkts bytes target prot opt in out source destination 6389K 4665M ufw-before-logging-forward all -- any any anywhere anywhere 6389K 4665M ufw-before-forward all -- any any anywhere anywhere 6389K 4665M ufw-after-forward all -- any any anywhere anywhere 6389K 4665M ufw-after-logging-forward all -- any any anywhere anywhere 6389K 4665M ufw-reject-forward all -- any any anywhere anywhere Chain OUTPUT (policy ACCEPT 123 packets, 7504 bytes) pkts bytes target prot opt in out source destination 5027K 4648M ufw-before-logging-output all -- any any anywhere anywhere 5027K 4648M ufw-before-output all -- any any anywhere anywhere 61051 4324K ufw-after-output all -- any any anywhere anywhere 61051 4324K ufw-after-logging-output all -- any any anywhere anywhere 61051 4324K ufw-reject-output all -- any any anywhere anywhere 61051 4324K ufw-track-output all -- any any anywhere anywhere Chain ufw-after-forward (1 references) pkts bytes target prot opt in out source destination Chain ufw-after-input (1 references) pkts bytes target prot opt in out source destination 175 13652 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:netbios-ns 0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:netbios-dgm 30 1388 ufw-skip-to-policy-input tcp -- any any anywhere anywhere tcp dpt:netbios-ssn 143 6380 ufw-skip-to-policy-input tcp -- any any anywhere anywhere tcp dpt:microsoft-ds 0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:bootps 0 0 ufw-skip-to-policy-input udp -- any any anywhere anywhere udp dpt:bootpc 0 0 ufw-skip-to-policy-input all -- any any anywhere anywhere ADDRTYPE match dst-type BROADCASTChain ufw-after-logging-forward (1 references) pkts bytes target prot opt in out source destination Chain ufw-after-logging-input (1 references) pkts bytes target prot opt in out source destination 85877 4224K LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "Chain ufw-after-logging-output (1 references) pkts bytes target prot opt in out source destination Chain ufw-after-output (1 references) pkts bytes target prot opt in out source destination Chain ufw-before-forward (1 references) pkts bytes target prot opt in out source destination 6389K 4665M ufw-user-forward all -- any any anywhere anywhere Chain ufw-before-input (1 references) pkts bytes target prot opt in out source destination 308K 32M ACCEPT all -- lo any anywhere anywhere 3405K 742M ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED 5247 288K ufw-logging-deny all -- any any anywhere anywhere state INVALID 5247 288K DROP all -- any any anywhere anywhere state INVALID 0 0 ACCEPT icmp -- any any anywhere anywhere icmp destination-unreachable 0 0 ACCEPT icmp -- any any anywhere anywhere icmp source-quench 0 0 ACCEPT icmp -- any any anywhere anywhere icmp time-exceeded 0 0 ACCEPT icmp -- any any anywhere anywhere icmp parameter-problem 436 17126 ACCEPT icmp -- any any anywhere anywhere icmp echo-request 0 0 ACCEPT udp -- any any anywhere anywhere udp spt:bootps dpt:bootpc 206K 11M ufw-not-local all -- any any anywhere anywhere 0 0 ACCEPT udp -- any any anywhere 224.0.0.251 udp dpt:mdns 0 0 ACCEPT udp -- any any anywhere 239.255.255.250 udp dpt:1900 206K 11M ufw-user-input all -- any any anywhere anywhere Chain ufw-before-logging-forward (1 references) pkts bytes target prot opt in out source destination Chain ufw-before-logging-input (1 references) pkts bytes target prot opt in out source destination Chain ufw-before-logging-output (1 references) pkts bytes target prot opt in out source destination Chain ufw-before-output (1 references) pkts bytes target prot opt in out source destination 308K 32M ACCEPT all -- any lo anywhere anywhere 4656K 4611M ACCEPT all -- any any anywhere anywhere state RELATED,ESTABLISHED 61003 4321K ufw-user-output all -- any any anywhere anywhere Chain ufw-logging-allow (0 references) pkts bytes target prot opt in out source destination 0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW ALLOW] "Chain ufw-logging-deny (2 references) pkts bytes target prot opt in out source destination 2476 148K RETURN all -- any any anywhere anywhere state INVALID limit: avg 3/min burst 10 128 12121 LOG all -- any any anywhere anywhere limit: avg 3/min burst 10 LOG level warning prefix "[UFW BLOCK] "Chain ufw-not-local (1 references) pkts bytes target prot opt in out source destination 206K 11M RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type LOCAL 0 0 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type MULTICAST 4 312 RETURN all -- any any anywhere anywhere ADDRTYPE match dst-type BROADCAST 0 0 ufw-logging-deny all -- any any anywhere anywhere limit: avg 3/min burst 10 0 0 DROP all -- any any anywhere anywhere Chain ufw-reject-forward (1 references) pkts bytes target prot opt in out source destination Chain ufw-reject-input (1 references) pkts bytes target prot opt in out source destination Chain ufw-reject-output (1 references) pkts bytes target prot opt in out source destination Chain ufw-skip-to-policy-forward (0 references) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any anywhere anywhere Chain ufw-skip-to-policy-input (7 references) pkts bytes target prot opt in out source destination 348 21420 DROP all -- any any anywhere anywhere Chain ufw-skip-to-policy-output (0 references) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any anywhere anywhere Chain ufw-track-input (1 references) pkts bytes target prot opt in out source destination Chain ufw-track-output (1 references) pkts bytes target prot opt in out source destination 16 1904 ACCEPT tcp -- any any anywhere anywhere state NEW 60802 4295K ACCEPT udp -- any any anywhere anywhere state NEWChain ufw-user-forward (1 references) pkts bytes target prot opt in out source destination Chain ufw-user-input (1 references) pkts bytes target prot opt in out source destination 46826 2776K ACCEPT tcp -- any any anywhere anywhere tcp dpt:ssh 1 57 ACCEPT udp -- any any anywhere anywhere udp dpt:ssh 715 74931 ACCEPT udp -- any any anywhere anywhere udp dpt:openvpn 2193 114K ACCEPT tcp -- any any anywhere anywhere tcp dpt:http-alt 1264 65840 ACCEPT tcp -- any any anywhere anywhere tcp dpt:http 153 8788 ACCEPT tcp -- any any anywhere anywhere tcp dpt:4848Chain ufw-user-limit (0 references) pkts bytes target prot opt in out source destination 0 0 LOG all -- any any anywhere anywhere limit: avg 3/min burst 5 LOG level warning prefix "[UFW LIMIT BLOCK] " 0 0 REJECT all -- any any anywhere anywhere reject-with icmp-port-unreachableChain ufw-user-limit-accept (0 references) pkts bytes target prot opt in out source destination 0 0 ACCEPT all -- any any anywhere anywhere Chain ufw-user-logging-forward (0 references) pkts bytes target prot opt in out source destination Chain ufw-user-logging-input (0 references) pkts bytes target prot opt in out source destination Chain ufw-user-logging-output (0 references) pkts bytes target prot opt in out source destination Chain ufw-user-output (1 references) pkts bytes target prot opt in out source destination ipconfig on Windows client: Ethernet adapter Ethernet 3: Connection-specific DNS Suffix . : Link-local IPv6 Address . . . . . : fe80::9ec:a83c:51ba:8661%5 IPv4 Address. . . . . . . . . . . : 10.8.0.6 Subnet Mask . . . . . . . . . . . : 255.255.255.252 Default Gateway . . . . . . . . . : ifconfig on my Linux client: tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.8.0.6 P-t-P:10.8.0.5 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:209 errors:0 dropped:0 overruns:0 frame:0 TX packets:620 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:52695 (51.4 Kb) TX bytes:71108 (69.4 Kb)ifconfig on my server: tun0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.8.0.1 P-t-P:10.8.0.2 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:2559262 errors:0 dropped:0 overruns:0 frame:0 TX packets:3865745 errors:0 dropped:989 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:445611223 (424.9 MiB) TX bytes:4221065665 (3.9 GiB)My goal is to be able to communicate client-to-client, what are the possible ways to achieve this?
OpenVPN server configuration
systemd-nspawn --network-interface=ppp0ppp0 will disappear from the host namespace. You can't share one IP address with a container and not your other IP addresses. (Apart from doing NAT). It looks like this might require a very recent kernel though. http://www.spinics.net/lists/netdev/msg339236.html OR (machine is created after ppp0): systemd-nspawn --private-networkip link set dev ppp0 netns $PIDwhere $PID is the pid in the host namespace of a process in container, obtained using P=$(machinectl $MACHINE_NAME show --property=Leader) PID=${P#Leader=}and $MACHINE_NAME is the value passed to the -M option of systemd-nspawn
I would like to set a container use the vpn for only network interface. I have used the pptpsetup and pon make a pptp connection works, and got a ppp0 interface. Now, I want all internet connection in the systemd-nspawn container go through the ppp0 . How can I make it work?
How to use systemd-nspawn with pptp?
I don't really understand, but : modprobe nf_conntrack_pptpand opening VPN via the GUI, instead of terminal, does the job :-/
So I've been pulling my hair this weekend. I've been trying to connect to a VPN server. I could do it successfully at my office using Windows, but I can't do it in my house using OpenSUSE. Here's the setup in my Linux box : # This module isn't loaded initially modprobe nf_conntrack_pptp pptpsetup --create my_vpn --server xxx.xx.xxx.xx --username xxx --password xxx pppd call my_vpn debug nodetachAnd the results are the following: using channel 6 Using interface ppp0 Connect: ppp0 <--> /dev/pts/4 sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xac5d988f> <pcomp> <accomp>] rcvd [LCP ConfReq id=0x1 <auth chap MS-v2> <mru 1460> <magic 0x72d37196>] sent [LCP ConfAck id=0x1 <auth chap MS-v2> <mru 1460> <magic 0x72d37196>] rcvd [LCP ConfRej id=0x1 <asyncmap 0x0> <pcomp> <accomp>] sent [LCP ConfReq id=0x2 <magic 0xac5d988f>] rcvd [LCP ConfAck id=0x2 <magic 0xac5d988f>] sent [LCP EchoReq id=0x0 magic=0xac5d988f] rcvd [CHAP Challenge id=0x1 <96a56e74b0a9c972625e5b2a6cfa7ff3>, name = "PS-RTR-INT@DC-CYBERCSF"] added response cache entry 0 sent [CHAP Response id=0x1 <6878d2f9bafc93c3fd22d7ef83a17cea000000000000000053ed1f4039642a8acec3150b3168abc02cbfa9368595c2a900>, name = "imam"] rcvd [LCP EchoRep id=0x0 magic=0x72d37196] rcvd [CHAP Success id=0x1 "S=FB862D3ADF2E8883281F43948FDAF07A06F71780"] response found in cache (entry 0) CHAP authentication succeeded sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 0.0.0.0>] rcvd [IPCP ConfReq id=0x1 <addr 20.20.20.1>] sent [IPCP ConfAck id=0x1 <addr 20.20.20.1>] rcvd [proto=0x8281] 01 01 00 04 Unsupported protocol 'MPLSCP' (0x8281) received sent [LCP ProtRej id=0x3 82 81 01 01 00 04] rcvd [IPCP ConfRej id=0x1 <compress VJ 0f 01>] sent [IPCP ConfReq id=0x2 <addr 0.0.0.0>] rcvd [IPCP ConfNak id=0x2 <addr 20.20.20.10>] sent [IPCP ConfReq id=0x3 <addr 20.20.20.10>] rcvd [IPCP ConfAck id=0x3 <addr 20.20.20.10>] local IP address 20.20.20.10 remote IP address 20.20.20.1 Terminating connection due to lack of activity. Connect time 45.9 minutes. Sent 12744 bytes, received 1344 bytes. sent [LCP TermReq id=0x4 "Link inactive"] rcvd [LCP TermAck id=0x4] Connection terminated. tcflush failed: Input/output error Script pptp xxx.xx.xx.xx --nolaunchpppd finished (pid 4616), status = 0x0As you can see, the connection is terminated due to lack of activity. The local IP address (20.20.20.10) refers to my computer obviously and I can use it normally, but the remote one (20.20.20.1) still not usable. Is there anything wrong in my setup?
VPN Client in OpenSUSE
PPtP creates a GRE tunnel after the authentication. GRE is a Point to Point (PtP) protocol. If you have a private IP and the router is doing NAT (most probably the case), in order to establish the connection your router should support GRE (TCP Proto 47) passthrough. If that is not enabled, you won't be able to connect to PPtP VPN.
I'm in China and trying to use expressvpn. openvpn doesn't work properly in the wifi, so the people from expressvpn told me to use a pptp-connection instead. I've set that up but I can't connect. When I click on connect I get the following messageStarting the service, that provides the VPN-connection, failedAny ideas what I could do?
PPTP-Connection not possible because required service can't start
As far as i can see the reconnection is immediate (although it sometimes takes some time for it to detect that connection is broken). I believe there's no lag between retries but you can set up it by using holdoff n where n is the number of seconds between the disconnection and next try to reconnect. As for a number of retries, it defaults to 10, but you can change it: with maxfail option you can get all the options by looking at man pppd.
I use to establish a connection to my VPN PPTP server by typing: pon MyVPN persistI want to know the reconnection timing details, but I have not found documentation enough about it. Specifically: - If there is a disconnection, does the PPTP client attempts to reconnect immediately? - What is the frequency of reconnection attemps (5 mins, 15 mins, variable... etc)? - The client stop trying to reconnect after some too long period (give-up time) without succeeding (6 hours, 1 day, etc)?
What is the reconnection policy of "persist" switch on "pon" command from pptp-linux package?
Just use time when you call the script: time yourscript.sh
I would like to display the completion time of a script. What I currently do is - #!/bin/bash date ## echo the date at start # the script contents date ## echo the date at endThis just show's the time of start and end of the script. Would it be possible to display a fine grained output like processor time/ io time , etc?
How to get execution time of a script effectively?
There are several aspects to this question which have been addressed partially through other tools, but there doesn't appear to be a single tool that provides all the features you're looking for. iotop This tools shows which processes are consuming the most I/O. But it lacks options to show specific file names. $ sudo iotop Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND 1 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % init 2 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kthreadd] 3 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [ksoftirqd/0] 5 be/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [kworker/u:0] 6 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [migration/0] 7 rt/4 root 0.00 B/s 0.00 B/s 0.00 % 0.00 % [watchdog/0]By default it does what regular top does for processes vying for the CPU's time, except for disk I/O. You can coax it to give you a 30,000 foot view by using the -a switch so that it shows an accumulation by process, over time. $ sudo iotop -a Total DISK READ: 0.00 B/s | Total DISK WRITE: 0.00 B/s TID PRIO USER DISK READ DISK WRITE SWAPIN IO> COMMAND 258 be/3 root 0.00 B 896.00 K 0.00 % 0.46 % [jbd2/dm-0-8] 22698 be/4 emma 0.00 B 72.00 K 0.00 % 0.00 % chrome 22712 be/4 emma 0.00 B 172.00 K 0.00 % 0.00 % chrome 1177 be/4 root 0.00 B 36.00 K 0.00 % 0.00 % cupsd -F 22711 be/4 emma 0.00 B 120.00 K 0.00 % 0.00 % chrome 22703 be/4 emma 0.00 B 32.00 K 0.00 % 0.00 % chrome 22722 be/4 emma 0.00 B 12.00 K 0.00 % 0.00 % chromei* tools (inotify, iwatch, etc.) These tools provide access to the file access events, however they need to be specifically targeted to specific directories or files. So they aren't that helpful when trying to trace down a rogue file access by an unknown process, when debugging performance issues. Also the inotify framework doesn't provide any particulars about the files being accessed. Only the type of access, so no information about the amount of data being moved back and forth is available, using these tools. iostat Shows overall performance (reads & writes) based on access to a given device (hard drive) or partition. But doesn't provide any insight into which files are generating these accesses. $ iostat -htx 1 1 Linux 3.5.0-19-generic (manny) 08/18/2013 _x86_64_ (3 CPU)08/18/2013 10:15:38 PM avg-cpu: %user %nice %system %iowait %steal %idle 18.41 0.00 1.98 0.11 0.00 79.49Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util sda 0.01 0.67 0.09 0.87 1.45 16.27 37.06 0.01 10.92 11.86 10.82 5.02 0.48 dm-0 0.00 0.00 0.09 1.42 1.42 16.21 23.41 0.01 9.95 12.22 9.81 3.19 0.48 dm-1 0.00 0.00 0.00 0.02 0.01 0.06 8.00 0.00 175.77 24.68 204.11 1.43 0.00blktrace This option is too low level. It lacks visibility as to which files and/or inodes are being accessed, just raw block numbers. $ sudo blktrace -d /dev/sda -o - | blkparse -i - 8,5 0 1 0.000000000 258 A WBS 0 + 0 <- (252,0) 0 8,0 0 2 0.000001644 258 Q WBS [(null)] 8,0 0 3 0.000007636 258 G WBS [(null)] 8,0 0 4 0.000011344 258 I WBS [(null)] 8,5 2 1 1266874889.709032673 258 A WS 852117920 + 8 <- (252,0) 852115872 8,0 2 2 1266874889.709033751 258 A WS 852619680 + 8 <- (8,5) 852117920 8,0 2 3 1266874889.709034966 258 Q WS 852619680 + 8 [jbd2/dm-0-8] 8,0 2 4 1266874889.709043188 258 G WS 852619680 + 8 [jbd2/dm-0-8] 8,0 2 5 1266874889.709045444 258 P N [jbd2/dm-0-8] 8,0 2 6 1266874889.709051409 258 I WS 852619680 + 8 [jbd2/dm-0-8] 8,0 2 7 1266874889.709053080 258 U N [jbd2/dm-0-8] 1 8,0 2 8 1266874889.709056385 258 D WS 852619680 + 8 [jbd2/dm-0-8] 8,5 2 9 1266874889.709111456 258 A WS 482763752 + 8 <- (252,0) 482761704 ... ^C ... Total (8,0): Reads Queued: 0, 0KiB Writes Queued: 7, 24KiB Read Dispatches: 0, 0KiB Write Dispatches: 3, 24KiB Reads Requeued: 0 Writes Requeued: 0 Reads Completed: 0, 0KiB Writes Completed: 5, 24KiB Read Merges: 0, 0KiB Write Merges: 3, 12KiB IO unplugs: 2 Timer unplugs: 0Throughput (R/W): 0KiB/s / 510KiB/s Events (8,0): 43 entries Skips: 0 forward (0 - 0.0%)fatrace This is a new addition to the Linux Kernel and a welcomed one, so it's only in newer distros such as Ubuntu 12.10. My Fedora 14 system was lacking it 8-). It provides the same access that you can get through inotify without having to target a particular directory and/or files. $ sudo fatrace pickup(4910): O /var/spool/postfix/maildrop pickup(4910): C /var/spool/postfix/maildrop sshd(4927): CO /etc/group sshd(4927): CO /etc/passwd sshd(4927): RCO /var/log/lastlog sshd(4927): CWO /var/log/wtmp sshd(4927): CWO /var/log/lastlog sshd(6808): RO /bin/dash sshd(6808): RO /lib/x86_64-linux-gnu/ld-2.15.so sh(6808): R /lib/x86_64-linux-gnu/ld-2.15.so sh(6808): O /etc/ld.so.cache sh(6808): O /lib/x86_64-linux-gnu/libc-2.15.soThe above shows you the process ID that's doing the file accessing and which file it's accessing, but it doesn't give you any overall bandwidth usage, so each access is indistinguishable to any other access. So what to do? The fatrace option shows the most promise for FINALLY providing a tool that can show you aggregate usage of disk I/O based on files being accessed, rather than the processes doing the accessing. Referencesfatrace: report system wide file access events fatrace - report system wide file access events Another new ABI for fanotify blktrace User Guide
This is a simple problem but the first time I've ever had to actually fix it: finding which specific files/inodes are the targets of the most I/O. I'd like to be able to get a general system overview, but if I have to give a PID or TID I'm alright with that. I'd like to go without having to do a strace on the program that pops up in iotop. Preferably, using a tool in the same vein as iotop but one that itemizes by file. I can use lsof to see which files mailman has open but it doesn't indicate which file is receiving I/O or how much. I've seen elsewhere where it was suggested to use auditd but I'd prefer to not do that since it would put the information into our audit files, which we use for other purposes and this seems like an issue I ought to be able to research in this way. The specific problem I have right now is with LVM snapshots filling too rapidly. I've since resolved the problem but would like to have been able to fix it this way rather than just doing an ls on all the open file descriptors in /proc/<pid>/fd to see which one was growing fastest.
Determining Specific File Responsible for High I/O
Start by using time as per Jon Lin's suggestion: $ time ls test testreal 0m0.004s user 0m0.002s sys 0m0.002sYou don't say what unix your scripts are running on but strace on linux, truss on Solaris/AIX, and I think tusc on hp-ux let you learn a lot about what a process is doing. I like strace's -c option to get a nice summary: ]$ strace -c ls test % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 89.19 0.000998 998 1 execve 10.81 0.000121 121 1 write 0.00 0.000000 0 12 read 0.00 0.000000 0 93 79 open 0.00 0.000000 0 16 close 0.00 0.000000 0 2 1 access 0.00 0.000000 0 3 brk 0.00 0.000000 0 2 ioctl 0.00 0.000000 0 4 munmap 0.00 0.000000 0 1 uname 0.00 0.000000 0 6 mprotect 0.00 0.000000 0 2 rt_sigaction 0.00 0.000000 0 1 rt_sigprocmask 0.00 0.000000 0 1 getrlimit 0.00 0.000000 0 30 mmap2 0.00 0.000000 0 8 7 stat64 0.00 0.000000 0 13 fstat64 0.00 0.000000 0 2 getdents64 0.00 0.000000 0 1 fcntl64 0.00 0.000000 0 1 futex 0.00 0.000000 0 1 set_thread_area 0.00 0.000000 0 1 set_tid_address 0.00 0.000000 0 1 set_robust_list 0.00 0.000000 0 1 socket 0.00 0.000000 0 1 1 connect ------ ----------- ----------- --------- --------- ---------------- 100.00 0.001119 205 88 totalDo also note that attaching these tracing type programs can slow the program down somewhat.
I have several programs that I'm executing in a shell script: ./myprogram1 ./myprogram2 ...I know that I can profile each individual program by editing the source code, but I wanted to know if there was a way I could measure the total time executed by profiling the script itself. Is there a timer program that I can use for this purpose? If so, how precise is its measurement?
How can I profile a shell script?
You can use perf to access the hardware performance counters: $ perf stat -e dTLB-load-misses,iTLB-load-misses /path/to/commande.g. : $ perf stat -e dTLB-load-misses,iTLB-load-misses /bin/ls > /dev/null Performance counter stats for '/bin/ls': 5,775 dTLB-load-misses 1,059 iTLB-load-misses 0.001897682 seconds time elapsed
Could some one direct me to a command to measure TLB misses on LINUX, please? Is it okay to consider (or approximate) minor page faults as TLB misses?
Command to measure TLB misses on LINUX?
It’s only security, performance isn’t affected (at least, when perf isn’t running; and even then, perf’s impact is supposed to be minimal). Changing perf_event_paranoid doesn’t change the performance characteristics of the system, whether perf is running or not. There’s a detailed discussion of the security implications of perf in the kernel documentation. The recommendation there is to set up a group for users with access to perf, and set perf up with the appropriate capabilities for that group, instead of changing perf_event_paranoid: cd /usr/bin groupadd perf_users chgrp perf_users perf chmod o-rwx perf setcap cap_sys_admin,cap_sys_ptrace,cap_syslog=ep perfand add yourself to the perf_users group. Version 5.8 of the kernel added a dedicated capability, so instead of granting all of cap_sys_admin, the last command can be reduced to setcap cap_perfmon,cap_sys_ptrace,cap_syslog=ep perf
I'd like to use the perf utility to gather measurements for my program. It runs on a shared cluster machine with Debian 9 where by default the /proc/sys/kernel/perf_event_paranoid is set to 3, therefore disallowing me to gather measurements. Before changing it, I'd like to know what the implications of this are. Is it just security that would allow other users to profile stuff run by other uses and therefore gain insights? We do not care about this as it is a inner circle of users anyway. Or is it performance perhaps, which will impact everyone else as well?
Security implications of changing “perf_event_paranoid”
You could check for references to function mcount (or possibly _mcount or __mcount according to Implementation of Profiling). This function is necessary for profiling to work, and should be absent for non-profiled binaries. Something like: $ readelf -s someprog | egrep "\s(_+)?mcount\b" && echo "Profiling is on for someprog"The above works on a quick test here.
Is it possible to check if given program was compiled with GNU gprof instrumentation, i.e. with '-pg' flag passed to both compiler and linker, without running it to check if it would generate a gmon.out file?
Detect if an ELF binary was built with gprof instrumentation?
mtrace still works, but the man page is outdated. The reference documentation explains how to use it: LD_PRELOAD=/usr/lib64/libc_malloc_debug.so.0 MALLOC_TRACE=/tmp/t ./t_mtrace(replace with the appropriate path to libc_malloc_debug.so on your system — the above is appropriate for Fedora and derivatives on 64-bit x86; on Debian derivatives, use LD_PRELOAD=/lib/$(gcc -print-multiarch)/libc_malloc_debug.so.0). In version 2.34 of the GNU C library, memory allocation debugging was moved to a separate library, which must be pre-loaded when debugging is desired.
tldr: Does mtrace still work or am I just doing it wrong? I was attempting to use mtrace and have been unable to get it to write data to a file. I followed the instructions in man 3 mtrace: t_mtrace.c: #include <mcheck.h> #include <stdlib.h> #include <stdio.h>int main(int argc, char *argv[]) { mtrace(); for (int j = 0; j < 2; j++) malloc(100); /* Never freed--a memory leak */ calloc(16, 16); /* Never freed--a memory leak */ exit(EXIT_SUCCESS); }Then running this in bash: gcc -g t_mtrace.c -O0 -o t_mtrace export MALLOC_TRACE=/tmp/t ./t_mtrace mtrace ./t_mtrace $MALLOC_TRACEbut the file /tmp/t (or any other file I attempt to use) is not created. When I create an empty file with that name it remains zero length. I've tried using relative paths in the MALLOC_TRACE. I tried adding setenv("MALLOC_TRACE", "/tmp/t", 1); inside the program before the mtrace() call. I've tried adding muntrace() before the program terminates. I've tried these tactics on Ubuntu 22.04 and Fedora 39, and I get the same result: the trace file is empty. The ctime and mtime on the file (if I create it in advance) are unchanged when I run the program. I've verified the permissions of the file and its parent directory are read/writable. strace isn't showing that the file in question is stated, much less opened. This occurs using Glibc 2.35 on Ubuntu and 2.38 on Fedora. This isn't a question on how to profile or check for memory leaks. I realize I can do this with valgrind or half a dozen other programs, this is mostly a curiosity and me wanting to know if this is a bug that might need to be patched or whether the man page needs updating (or whether I'm just misapprehending something and the only problem is sitting in my chair).
Does mtrace() still work in modern distros?
Meanwhile I wrote my own program - audria - capable of monitoring the resource usage of one or more processes, including current/average CPU usage, virtual memory usage, IO load and other information.
I am looking for a way to profile a single process including time spent for CPU, I/O, memory usage over time and optionally system calls. I already know callgrind offering some basic profiling features but only with debugging information and lacking most of the other mentioned information. I know strace -c providing a summary about all system calls and their required CPU time. I know several IO-related tools like (io)top, iostat, vmstat but all of them are lacking detailed statistics about a single process. There is also /proc/$PID/io providing some IO statistics about a single process, but I would have to read it at fixed intervals in order to gather IO information over time. I know pidstat providing CPU load, IO statistics and memory utilization but no system calls, only at a high granularity and not over time. One could of course combine several of the described tools to gather those information over time, but lacking a high granularity and thus missing important information. What I am looking for is a single tool providing all (or at least most) of the mentioned information, ideally over time. Does such a tool exist?
Detailed Per-Process Profiling
I don't have an answer but you might find one amongst the tools, examples and resources written or listed by Brendan Gregg on the perf command and Linux kernel ftrace and debugfs. On my Raspberry Pi these tools were in package perf-tools-unstable. The perf command was actually in /usr/bin/perf_3.16.Of interest may be this discussion and context-switch benchmark by Benoit Sigoure, and the lat_ctx test from the fairly old lmbench suite. They may need some work to run on the Pi, for example with tsuna/contextswitch I edited timectxswws.c get_iterations() to while (iterations * ws_pages * 4096UL < 4294967295UL) {, and removed -march=native -mno-avx from the Makefile.Using perf record for 10 seconds on the Pi over ssh whilst simultaneously doing while sleep .1;do echo hi;done in another ssh: sudo timeout -10 perf_3.16 record -e context-switches -a sudo perf_3.16 script -f time,pid,comm | lessgives output like this sleep 29341 2703976.560357: swapper 0 2703976.562160: kworker/u8:2 29163 2703976.564901: swapper 0 2703976.565737: echo 29342 2703976.565768: migration/3 19 2703976.567549: sleep 29343 2703976.570212: kworker/0:0 28906 2703976.588613: rcu_preempt 7 2703976.609261: sleep 29343 2703976.670674: bash 29066 2703976.671654: echo 29344 2703976.675065: sshd 29065 2703976.675454: swapper 0 2703976.677757: presumably showing when a context-switch event happened, for which process.
I'm trying to get the nearest to real-time processing I can with a Raspbian distribution on a Raspberry Pi for manipulating its GPIO pins. I want to get a "feel" for the kind of performance I can expect. I was going to do this by writing a simple C program that toggles a pin repeatedly as fast as possible, and monitoring it with a logic analyser. But perhaps there's another way, by writing the above program but simply logging context switches to see exactly when that thread/process has control over a sample period of say a couple of seconds. This previous question answers how to see how many context switches are made in some period of time for a given process, but is there a way of logging the precise timing of switches, and perhaps for every process, not just one? Obviously this would create overhead, but could still be useful. Obviously the data should be stored in RAM to minimise overhead Note to self: possible solutions:Command to list in real time all the actions of a process Hacky: make the program repeatedly get and store the current time (and save it to a file once the log reaches a certain limit). Or, a slight improvement to avoid enormous logs: use an algorithm that eliminates consecutive times if they are close enough together that it can be deduced they were not pre-empted by some other process.
Record time of every process or thread context switch
Not stock, but here are a few tool I have used before:primes (usually in your distributions games package) just simply fork off a few dozen and it will generate primes from now until forever. Stress: http://people.seas.harvard.edu/~apw/stress/ CPUBurn: http://patrickmylund.com/projects/cpuburn/
I am playing around with htop, gprof, etc. I'd like a program that basically just runs on multiple cores so I can profile it and learn how to use these tools. I know I can write my own c++ code with -fopenmp and run a useless loop, but I was hoping there's a stock unix command I can use? Basically I just want a program that uses 100% of however many cores I tell it, until I ask it to stop. Does this exist?
Is there a mock program that uses the CPU on multiple cores?
You can easily get something close (with reasonably recent versions): a timestamp on each step. From the documentation of -x:The output is preceded by the value of $PS4, formatted as described in Prompt Expansion.You can put a timestamp in the trace prefix. %. gives you nanosecond precision with zsh ≥5.6, only microsecond precision between 5.0.6 and 5.5.x. I think that in earlier versions, which don't have %D, you can only get second precision. PS4='+%D{%s.%9.}:%N:%i>' zsh -x …You can then post-process the trace to calculate the differences between successive timestamps. <trace awk -F: '{printf "+%.09f", $1 - t; t=$1; $1=""; print}'
The following command gives me the full trace of steps zsh -i -c -x exit > trace 2>&1I'd love for it to also capture, next to each exact step (e.g. as a first column), how long that step took. Does Zsh provide an easy way to do that?
Tracing and timing every step of the initialization of the shell
Based on the question and comments, you could look up the java running call stack via the jstack command: jstack processidIf there are some threads waiting for a long time on some condition then it is most likely a deadlock. A deadlock might be rare on production grade code but common on experimental multithreaded code. In the former case, a rerun might fix the issue but in the later case a detailed debugging might be required.
I have a java program which implements the Hungarian algorithm. I made changes to the existing code in such a way that the input is read from file. I have a pretty huge input around 32,000 rows for which I am calculating the maximum edge weight. The problem is, when I run the program using the command, java Hungarian_algorithm.javafor which, I got an error, java.lang.outofMemoryError:java Heap space error. So, after researching a bit on the error, I ran the program using the below command. java -d64 -Xms6g -Xmx8g Hungarian_algorithmI started the execution 2 days back and the program has still not produced any output. So, I decided to check the memory consumption in the server. Output of top command PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 20760 ramesh 20 0 8482m 5.9g 3484 S 101 75.9 3099:13 java output of free -m command total used free shared buffers cached Mem: 7991 7937 54 0 37 1432 -/+ buffers/cache: 6467 1524 Swap: 30514 4626 25888Should I wait for the program to produce some output or some error atleast or kill the execution of the program?
program executing for 2 days
Not sure exactly.. but looks like you might need strace ... Example: Here, say if I have a process with process id 1055 then doing something like this : neo $ sudo strace -w -c -p1055strace: Process 1055 attached ^Cstrace: Process 1055 detached % time seconds usecs/call calls errors syscall ------ ----------- ----------- --------- --------- ---------------- 77.38 5.738820 534 10730 read 5.35 0.396752 114 3480 clone 4.17 0.309514 10 30741 rt_sigprocmask 2.31 0.171203 13 12761 close 1.56 0.115981 16 6960 3480 wait4 1.47 0.108800 10 10441 rt_sigaction 1.43 0.106307 8 11890 fcntl 0.98 0.072344 19 3770 openat 0.86 0.063769 18 3480 write 0.85 0.062820 18 3480 pipe 0.84 0.062443 15 4060 dup2 0.67 0.049338 9 5220 lseek 0.57 0.042007 11 3770 3770 ioctl 0.49 0.036669 10 3480 rt_sigreturn 0.47 0.035150 10 3480 fchmod 0.29 0.021420 12 1740 unlink 0.25 0.018666 10 1740 getpid 0.06 0.004745 16 290 statdo read more here: man straceas well as here: https://strace.io/
In my program, real time duration is sometimes as much as 3 times that of cpu time. This is a single thread application that does a lot of memory allocation and NFS base read/write. So my doubt is that it is either mem-swap or NFS read-write that is slowing things down. For example, the following is the output of /usr/bin/time a.out 2165.32user 64.93system 6036.33elapsedIs there any profiling tool for real time? I know and have used multiple tools for cpu time profiling, but am not sure if there is anything that can help and point out NFS / mem-swap or any other wall clock slowdowns. My program is written in C++ EDIT : /usr/bin/time gives me a summary at the end - I am not looking for that. I am looking for a way to correlate the real-time consumption during specific program blocks of my application. A profiler like collect/gprof that can tell me things likethe area where most context switches are happening due to waits. specific functions where NFS access is happening.Since my system is dedicated, I am not worried about other processes that might impact these profiles.
How to profile wall-clock time?
I personally wouldn't dig that deep. I'd recommend not building your own atril, but using the debian atril (because that's what you'll use afterwards, and also, debian gives you debugsymbols). By order of complexity:run top (better even: htop, and in its settings disactivate "Hide userland process threads") while starting atril. Is the process using a lot of CPU? Go to perf or gdb. gdb is often good enough for such things:install the debug symbols for atril, see the debian wiki start gdb, loading atril: gdb atril (hint: gdb may tell you you're missing a few debug symbols – you can install these, too, so you can decipher backtraces more easily when they're not currently in atril) at the (gdb) shell, say run In the 15s of boredom, press ctrl+c. This interrupts the execution in gdb since atril is probably multi-threaded, info threads will show you were each thread is stuck Select the most interesting thread by its number N, by typing thread N get a backtrace: bt. You'll see where you're coming from.if it's not using CPU itself, it's almost certainly waiting for a system call to finish. strace atril will tell display the calls it does, live. what are the last few calls you get? maybe it tries to sleep? if you're CPU-bound, and generally, the perf command from the linux-base package is great: sudo sysctl -w kernel.perf_event_paranoid=-1, and then perf record -ag atril will sample regularly where the execution is stuck (but it looks at all processes, so close your browser, folding at home and whatnot), and then, perf report -g from the same directory shows you browsable statistics. These get more useful if you have debugging symbols installed.
I run Debian 10 and since two weeks or so the PDF reader Atril (a fork of Evince) takes 25 seconds to start. Previously it started almost instantly. Now I'm trying to find out what causes the delay. I have downloaded the source package and built and installed it with profiling enabled: cd "$HOME/.local/src" apt source atril cd atril-1.20.3 ./autogen.sh ./configure CFLAGS=-pg LDFLAGS=-pg --prefix="$HOME/.local" --disable-caja make V=1 make installHowever, when I launch "$HOME/.local/bin/atril" no file named gmon.out is created. With verbose mode V=1 in the make command I can see that the option -pg is added to compilation and linking commands. Any clues? What's missing? There are several tutorials on the internet showing how to profile simple statically linked example programs but how do we profile "real world" applications? Edit: It turned out that gmon.out was created in my home directory. However, when I run Atril through gprof the resulting output doesn't say much because the application is multi-threaded.
How do I profile a real world application?
I wanted to update my question with the information I found in case someone else ever has a similar question. My understanding of Linux tracing tools is that most use probes (which I'm using to describe instrumentation that is dynamically inserted into an executable's binary) and tracepoints (which I'm using to describe instrumentation compiled into code that can be enabled or disabled) to track larger scale events (e.g., function calls). As a result, these tools are not helpful for tracing something as fine grain as memory accesses. Valgrind is very useful for tracing all memory accesses made by user code (but not kernel code because it executes the program on a synthetic CPU). From the docs:Your program is then run on a synthetic CPU provided by the Valgrind core. As new code is executed for the first time, the core hands the code to the selected tool. The tool adds its own instrumentation code to this and hands the result back to the core, which coordinates the continued execution of this instrumented code.This would seem to suggest that such trace information needs to be collected at the level of the component that hands off each instruction to be executed. Therefore, without using a simulator, there doesn't seem to be a method for getting this depth and breadth of information when executing user and kernel code. This brings me to the only solution I've found: perf_event_open(). It can sample memory accesses using the performance monitoring unit (PMU) of the processor. perf_event_open() can provide a sufficient depth of information (e.g., instruction pointer, memory address, program registers) but not breadth (since it can only sample memory accesses). (Additionally, the perf mem frontend is a good and easy place to start collecting such information about memory accesses. Samples can then be processed offline using perf script.)
I would like to generate a log of all virtual memory accesses performed in user mode and kernel mode as a result of running some program. Besides collecting memory access locations, I also want to capture other state information (e.g., instruction pointer, thread identifier). I anticipate that I won't be able to collect all of my desired statistics with any tool out of the box. I intend on doing this profiling off-line, so I'm not concerned about the performance impacts. In fact, depending on what is available, it would be helpful to know which tools can record all memory accesses and which can only sample. I was originally going to augment Valgrind's lacky tool until I realized that it only records user mode memory accesses. Looking into what other tools I might use, I'm at a loss at how I can quickly determine which tool is capable of capturing the information I want. Here are some resources I've found that have gotten me started:Brendan Gregg's Choosing a Linux Tracer Julia Evans' Linux tracing systems & how they fit together
How can I profile virtual memory accesses made in user mode and kernel mode?
Take a look at this article titled: perf Examples, it has a number of examples that show how you can make flame graphs such as this one:The above graph can be generated as an interactive SVG file as well. The graph was generated using the FlameGraph tool. This is separate software from perf. A series of commands similar to this were used to generate that graph: $ perf record -a -g -F 99 sleep 60 $ perf script | ./stackcollapse-perf.pl > out.perf-folded $ ./flamegraph.pl out.perf-folded > perf-kernel.svgThe CPU FlameGraphs (above) are covered in more detail in this article, titled: CPU Flame Graphs. For details on FlameGraphs for other resources such as memory check out this page titled: Flame Graphs.
It's possible to create a bitmap or a vector image out of the data collected by the perf profiler under linux ?
Does perf includes some "graphing" abilities?
Eventually found the answer. Kind of obvious and I'm a little ashamed I didn't think of it before. But here it goes: Bascially blktrace/blkparse are the commands we're looking for. This is the general idea I'm basing it off of, but I can pipe the output of blktrace to blkparse then save blkparse's output to a file. Once the profiling is done I can look at the activity logs at the top, filtering for the pids I'm interested in with awk. Saving all the output to a file is so I can use awk to filter for PID's but I can also use it's summary section at the end. Basically the regular output of blkparse's activity log are lines like this: 8,0 3 523 55.007588437 22191 M WS 548087528 + 8 [qemu-kvm]"22191" is the PID and "M" means that it was back merged with a request already issued to the device, "WS" means it was a synchronous write starting at sector 548087528 and going for eight more sectors. More information about blktrace can be found in their users manual. Figured that I would post this for posterity.
Are there any system tools that allow you to profile an application's usage of storage? Basically, I'm looking for information on determining whether there are more large sequential reads, tiny sequential read, random writes with backtracks, etc.
Establishing I/O Patterns for an Application
Restart logind: # systemctl restart systemd-logindBeware that restarting dbus will break their connection again.
I keep getting the following error messages in the syslog of one of my servers: # tail /var/log/syslog Oct 29 13:48:40 myserver dbus[19617]: [system] Failed to activate service 'org.freedesktop.login1': timed out Oct 29 13:48:40 myserver dbus[19617]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Oct 29 13:49:05 myserver dbus[19617]: [system] Failed to activate service 'org.freedesktop.login1': timed out Oct 29 13:49:05 myserver dbus[19617]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service'They seem to correlate to FTP Logins on the ProFTPd daemon: # tail /var/log/proftpd/proftpd.log 2015-10-29 13:48:40,433 myserver proftpd[17872] myserver.example.com (remote.example.com[192.168.22.33]): USER switch: Login successful. 2015-10-29 13:48:40,460 myserver proftpd[17872] myserver.example.com (remote.example.com[192.168.22.33]): FTP session closed. 2015-10-29 13:48:40,664 myserver proftpd[17881] myserver.example.com (remote.example.com[192.168.22.33]): FTP session opened. 2015-10-29 13:49:05,687 myserver proftpd[17881] myserver.example.com (remote.example.com[192.168.22.33]): USER switch: Login successful. 2015-10-29 13:49:05,705 myserver proftpd[17881] myserver.example.com (remote.example.com[192.168.22.33]): FTP session closed. 2015-10-29 13:49:05,908 myserver proftpd[17915] myserver.example.com (remote.example.com[192.168.22.33]): FTP session opened.The FTP logins themselves seem to work without problems for the user, though. I've got a couple of other servers also running ProFTPd but so far never got these errors. They might be related to a recent upgrade from Debian 7 to Debian 8 though. Any ideas what the message want to tell me or even what causes them? I already tried restarting the dbus and proftpd daemons and even the server and made sure that the DBUS socket /var/run/dbus/system_bus_socket is existing but so far the messages keep coming. EDIT: The output of journalctl as requested in the comment: root@myserver:/home/chammers# systemctl status -l dbus-org.freedesktop.login1.service ● systemd-logind.service - Login Service Loaded: loaded (/lib/systemd/system/systemd-logind.service; static) Active: active (running) since Tue 2015-10-27 13:23:32 CET; 1 weeks 0 days ago Docs: man:systemd-logind.service(8) man:logind.conf(5) http://www.freedesktop.org/wiki/Software/systemd/logind http://www.freedesktop.org/wiki/Software/systemd/multiseat Main PID: 467 (systemd-logind) Status: "Processing requests..." CGroup: /system.slice/systemd-logind.service └─467 /lib/systemd/systemd-logindOct 28 10:15:25 myserver systemd-logind[467]: New session c3308 of user switch. Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3308. Oct 28 10:15:25 myserver systemd-logind[467]: New session c3309 of user switch. Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3309. Oct 28 10:15:25 myserver systemd-logind[467]: New session c3310 of user switch. Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3310. Oct 28 10:15:25 myserver systemd-logind[467]: New session c3311 of user switch. Oct 28 10:15:25 myserver systemd-logind[467]: Removed session c3311. Oct 28 10:19:52 myserver systemd-logind[467]: New session 909 of user chammers. Oct 28 10:27:11 myserver systemd-logind[467]: Failed to abandon session scope: Transport endpoint is not connectedAnd more journalctl output: Nov 03 16:21:19 myserver dbus[19617]: [system] Failed to activate service 'org.freedesktop.login1': timed out Nov 03 16:21:19 myserver proftpd[23417]: pam_systemd(proftpd:session): Failed to create session: Activation of org.freedesktop.login1 timed out Nov 03 16:21:19 myserver proftpd[23418]: pam_systemd(proftpd:session): Failed to create session: Activation of org.freedesktop.login1 timed out Nov 03 16:21:19 myserver proftpd[23417]: pam_unix(proftpd:session): session closed for user switch Nov 03 16:21:19 myserver proftpd[23418]: pam_unix(proftpd:session): session closed for user switch Nov 03 16:21:19 myserver proftpd[23420]: pam_unix(proftpd:session): session opened for user switch by (uid=0) Nov 03 16:21:19 myserver dbus[19617]: [system] Activating via systemd: service name='org.freedesktop.login1' unit='dbus-org.freedesktop.login1.service' Nov 03 16:21:19 myserver proftpd[23421]: pam_unix(proftpd:session): session opened for user switch by (uid=0)
dbus: [system] Failed to activate service 'org.freedesktop.login1': timed out
Use pam and geoip moduleThis PAM module provides GeoIP checking for logins. The user can be allowed or denied based on the location of the originating IP address. This is similar to pam_access(8), but uses a GeoIP City or GeoIP Country database instead of host name / IP matching.
Is there any (simple) way to deny FTP connections based on the general physical location? I plan to use FTP as a simple cloud storage for me and my friends. I use an odroid c2 (similar to raspberry pi but uses arm64 architecture) running Debian 8 with proftpd and ufw as my firewall. Ftp server runs on a non-standard port which I prefer not to mention here. I want to do this to increase the security of my server.
Limit FTP connections by area
To achieve this, the URL must be RFC 2255 compliant and, using Proftpd queries will only work when they are filtered by an OU. These queries will not work at LDAP root level. LDAPServer ldap://domaincontroller.domain.net:389/??subOrganizational Unity: LDAPDoAuth on "OU=OFFICE,dc=domain,dc=net" (&(sAMAccountName=%v)(objectclass=User))Umask inside the dir. The limits are just for safety <Directory /> Umask 022 022 AllowOverwrite on <Limit MKD XMKD CDUP XCUP CWD XCWD RMD XRMD> DenyAll </Limit> </Directory>
I'm trying to get a ProFTPD to LDAP auth on a Active Directory base. I still couldn't figure out what could be wrong with my configuration since, executing a LDAP query with ldapsearch seems fine proftpd.conf /etc/proftpd.conf# This is the ProFTPD configuration file ServerName "FTP and Ldap" ServerType standalone ServerAdmin [emailprotected] AuthOrder mod_ldap.c LoadModule mod_ldap.c DefaultServer on ShowSymlinks on RootLogin off UseIPv6 off AllowLogSymlinks on IdentLookups off UseReverseDNS off Umask 077 User ftp Group ftp DefaultRoot /home/ftp/%u/ DefaultChDir ftp RequireValidShell off UseFtpUsers off SystemLog /var/log/proftpd/proftpd.log TransferLog /var/log/proftpd/xferlog DefaultTransferMode binary<IfModule mod_ldap.c> LDAPServer domaincontroller.domain.net LDAPAttr uid sAMAccountName LDAPDNInfo cn=linux.ldap,ou=users,ou=resources,dc=domain,dc=net password LDAPAuthBinds on LDAPDoAuth on "dc=domain,dc=net" (&(sAMAccountName=%v)(objectclass=User)) LDAPQueryTimeout 15 LDAPGenerateHomedir on LDAPGenerateHomedirPrefix /home/ftp #uid e guid of the local global user LDAPDefaultUID 14 LDAPDefaultGID 50 LDAPForceDefaultUID on LDAPForceDefaultGID on </IfModule><Directory /*> AllowOverwrite on </Directory>proftpd -nd10 -> "search failed" Running proftpd with a debug level of 10 I got these logs while authenticating with my user (nicolas): proftpd -nd10dispatching CMD command 'PASS (hidden)' to mod_auth mod_ldap/2.8.22: generated filter dc=domain,dc=net from template dc=domain,dc=net and value nicolas mod_ldap/2.8.22: generated filter (&(sAMAccountName=nicolas)(objectclass=User)) from template (&(sAMAccountName=%v)(objectclass=User)) and value nicolas mod_ldap/2.8.22: attempting connection to ldap://domaincontroller.domain.net/ mod_ldap/2.8.22: set protocol version to 3 mod_ldap/2.8.22: connected to ldap://domaincontroller.domain.net/ mod_ldap/2.8.22: successfully bound as cn=linux.ldap,ou=users,ou=resources,dc=domain,dc=net password mod_ldap/2.8.22: set dereferencing to 0 mod_ldap/2.8.22: set query timeout to 15s mod_ldap/2.8.22: pr_ldap_search(): LDAP search failed: Operations errorldapsearch works But ldapsearch on the other hand works just fine: [root@ftp2 ~]# ldapsearch -x -W -D "cn=linux.ldap,ou=users,ou=resources,dc=domain,dc=net" -h domaincontroller.domain.net -b "dc=domain,dc=net" -LLL "(SAMAccountName=nicolas)" Enter LDAP Password: dn: CN=Nicolas XXXXXXX,OU=XXXXXXX,OU=XXXXXXX,OU=XXXXXXX,DC=XXXXXXX,DC=XXXXXXX objectClass: top objectClass: person objectClass: organizationalPerson objectClass: user cn: Nicolas XXXXXXX sn: XXXXXXX description:XXXXXXX givenName: XXXXXXX distinguishedName:Any clues?
Configuring proftpd and mod_ldap.c query not working - any ideas?
ProFTPD has the mod_vroot module for this purpose. You can compile this module into ProFTPD yourself or install it if your repositories have it (apt-get install proftpd-mod-vroot for certain Debian repositories). mod_vroot allows a user to configure a "virtual chroot", setting the DefaultRoot directive (the initial/root directory for a session; ProFTPD would chroot to this directory without mod_vroot), but allowing symbolic links to point outside of the DefaultRoot path. mod_vroot also supports the VRootServerRoot directive, to which ProFTPD will perform a real chroot, meaning that symlinks can point outside of the DefaultRoot, but must target locations within the VRootServerRoot path. Example config: <IfModule mod_vroot.c> VRootEngine on VRootServerRoot /usr/share/ # Symlinks can only point to location within /usr/share/ VRootOptions allowSymlinks DefaultRoot /usr/share/ftproot/ </IfModule>
Can I use ProFTPd without using a chroot jail (thereby preventing access to anything outside of the FTP root)? I have a requirement to have symlinks in my FTP source that point to locations outside of the directory where I root my FTP service. All of the docs and discussion I've read on ProFTPd talk about how to use the chroot functionality (even within StackExchange), but I'm wondering if I can bypass using that and use a different method to serve my FTP root. Since the symlinks must remain as symlinks, mounting the directories as a way of bypassing the chroot restriction (the clever "solution" to the problem) does not work.
Implement ProFTPd server without chroot
As far as I understand there are no special operations like append and rename that you can configure. An append effectively is opening a file and then writing it with a different content (even if you only add to the file). You will need to have write privileges on that file. A rename effectively is moving a file from an old location to another new location. You will need to have write privileges in that directory
On one of my servers, I have ProFTPD installed in Debian 7. I need special permission only for 2 specific folders. These are: append - user must be able to append data to an existing file rename - user must not be able to rename file if same exists How can I do this?
How to set special folder permission on proFTPD?
ProFTPd, like many other services on Unix, uses syslog to do logging. syslog is a process running with superuser privileges. This means that ProFTPd itself never has to create files in the log directory. Yes. It is as it should be. DON'T CHANGE THIS In general, any logged user activities should only be accessible by the superuser. This is to protect the users' privacy. This is my personal opinion.For further information about logging with ProFTPd, see http://www.proftpd.org/docs/howto/Logging.html In general, assume that a service that you have installed behaves as intended, unless it obviously misbehaves. If it's a program installed from a package manager, then it has obviously undergone testing on the version of Unix that you run, and if you find a bug you should contact the package maintainer about this. Most of the time, though, "bugs" are usually the result of running on a highly customised system or with extreme or unusual configurations, and getting it wrong. A default install is very seldom wrong, and should only be "tweaked" once you really know what you're doing. This goes especially for changing permissions or ownership on files and directories.
I'm using proftpd on my server (ubuntu 16.04 x86_64). I see that proftpd run under proftpd user: $ ps aux | grep [p]roftpd proftpd 26334 0.0 0.1 112656 716 ? Ss 04:39 0:00 proftpd: (accepting connections)proftpd write logs to /var/log/proftpd. But write to this directory can only root: $ ls -la /var/log | grep [p]roftpd drwxr-xr-x 2 root adm 4096 Jun 1 04:39 proftpd ls -la /var/log/proftpd total 76 drwxr-xr-x 2 root adm 4096 Jun 1 04:39 . drwxrwxr-x 7 root syslog 4096 Jun 1 04:39 .. -rw-r----- 1 root adm 0 May 15 15:53 controls.log -rw-r----- 1 root adm 7611 Jun 1 09:54 proftpd.log -rw-r----- 1 root adm 23207 May 29 04:39 proftpd.log.1 -rw-r----- 1 root adm 3649 May 21 04:39 proftpd.log.2.gz -rw-r----- 1 root adm 521 Jun 1 09:42 xferlog -rw-r--r-- 1 root adm 17656 May 31 22:55 xferlog.1 -rw-r--r-- 1 root root 0 Jun 1 04:39 xferreportHow proftpd write logs? Is it right way, that owner of proftpd directory is root. May be it should be proftpd? Why files (logs) has no permissions to read for other. Is it unsecure?
How process (user1) can write log to directory (root)
Answering my own question: I was able to solve the problem by restoring the configuration of my /etc/proftpd.conf to AuthOrder mod_auth_pam.c* mod_auth_unix.cSELinux was configured by setting the following flags: setsebool ftpd_full_access 1 setsebool ftp_home_dir 1Apparently the problem was related with mod_auth_unix.c which is forbidden by SELinux to work, while mod_auth_pam.c can do it just fine. A case of PEBCAK. The only think I cannot figure out at this point is why nothing was reported in /var/log/audit/audit.log: I'm positive that SELinux prevented the login, since I was able to login while in Permissive mode.
I need a FTP server on my machine, a Fedora 23. I want a simple setup, and I decided for ProFTPd and authentication with mod_auth_unix.c (this is just about my machine). I installed ProFTPd and configured it. I had some problem in logging in from the local machine, and eventually I realized the problem was related to SeLinux (by simply tring to set it as Permissive). I'm trying (and failing) to figure out how to change the SELinux configuration in order to add the permission I need. This is what I've done so far:From the Audit I got: denied { dac_read_search } for pid=16049 comm="proftpd" capability=2 scontext=system_u:system_r:ftpd_t:s0-s0:c0.c1023 tcontext=system_u:system_r:ftpd_t:s0-s0:c0.c1023 tclass=capability permissive=0According to this article I need to enable the ftp_home_dir and allow_ftpd_full_access booleans. I started by setting the first one, and obtaining a different situation:Still failure to log, but no audit message /var/log/secure says: proftpd[16070]: 127.0.0.1 (::1[::1]) - USER dave (Login failed): No such user foundApparently there's no allow_ftpd_full_access in my semanage boolean -l. I can enable it anyway, but without getting a different behaviour. None of the following not-always related booleans seem to work (tried all of them, just for good measure): sftpd_full_access ftpd_anon_write ftpd_connect_db ftpd_full_access ftpd_use_cifs sftpd_enable_homedirs ftpd_connect_all_unreserved sftpd_write_ssh_home ftpd_use_passive_mode sftpd_anon_write ftpd_use_nfs ftpd_use_fusefsIt must be a selinux problem because it works if I set it to permissive. Weirdly enough, however, the Audit log is not reporting SELinux activity. I believe the FTP server is forbidden to access /etc/passwd or /etc/shadow. Any hint or idea?
SELinux, ProFTPd and the silent log
In /etc/modules-load.d, add a file {filename}.conf. That file should have the following contents: nf_conntrack_ftpDo the following for more info: man modules-load.dHere's the doc for RHEL7: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/sec-Persistent_Module_Loading.html
I'm stumped. I've seen the related questions about editing /etc/sysconfig/iptables-config, but I'm running CentOS 7 (and webmin/virtualmin), which uses firewalld instead of iptables. How do I get modprobe nf_conntrack_ftp to persist after a reboot? I tried setting up a cron on reboot to issue the command, but that didn't work (and is probably the wrong way to go about it anyway). Right now after every reboot I have to login and type in the command manually in order to get FTP connections to work correctly. Thanks.
How to make modprobe nf_conntrack_ftp persist a reboot on CentOS 7 and firewalld?
FTP is a horrible protocol. It uses two ports -- one for commands, one for data. This makes it notoriously difficult to NAT, since a router would need to parse the command channel and figure out that a second connection is expected for this FTP conversation. Doing so is ugly, but also the only way to make NAT work with FTP. FTPS encrypts the command channel, thereby making it impossible for any router to inspect the packets and figure out where the data channel is going to be. Obviously that means it won't be able to account for that then; so when your data channel is initiated by the client (as required by PASV) your NATting router won't know what to do with it. It is not possible to fix this, due to the way FTP works. Just say no to FTP, and use SFTP or something of the sort instead (which transfers files over an SSH tunnel and therefore requires only one TCP connection). Most graphical FTP clients have support for SFTP too, these days.
I've been trying to configure my FTPS server which is behind NAT. so I've opened ports 20, 21 as well as 2120-2180 in my NAT (TCP+UDP) and configured proftpd to use this ports for passive communications. However, trying to connect using FileZilla leads to the following log: (in french, but quite clear actually) Statut : Résolution de l'adresse de heardrones.com Statut : Connexion à 93.30.208.56:21... Statut : Connexion établie, attente du message d'accueil... Réponse : 220 ProFTPD 1.3.5 Server (HEAR Server) [93.30.208.56] Commande : USER hear_downloader Réponse : 331 Mot de passe requis pour hear_downloader Commande : PASS ******** Réponse : 230 Utilisateur hear_downloader authentifié Commande : OPTS UTF8 ON Réponse : 200 UTF-8 activé Statut : Connecté Statut : Récupération du contenu du dossier... Commande : PWD Réponse : 257 "/" est le répertoire courant Commande : TYPE I Réponse : 200 Type paramétré à I Commande : PASV Erreur : Délai d'attente expiré Erreur : Impossible de récupérer le contenu du dossierIt times out before even being capable of sending the "PASV" answer ! What could cause this ? The answer to PASV command uses the same port as all other commands (PWD, TYPE ...), so where could it come from ?Here is the network design : Server Proftpd, no iptables, fix IP 192.168.0.13 -> (Wifi) ISP Box - French ISP (SFR) port transfer 20,21,22,2120-2180 to 192.168.0.13 -> (optic fiber !) InternetI can give Box settings screenshots and proftpd config files if needed. Connecting from LAN/Localhost works perfectly.
Proftpd doesn't answer to "PASV" command
Quote from ProFTPD: Configuring LimitsWhat if a site wished to allow only anonymous access? This would be configured using the LOGIN command group, as above:<Limit LOGIN> DenyAll </Limit><Anonymous ~ftp> <Limit LOGIN> AllowAll </Limit> ... </Anonymous>The <Limit> section outside of the <Anonymous> section denies logins to everyone. However, the <Anonymous> section has a <Limit> that allows everyone to login; anonymous logins are allowed, and non-anonymous logins are denied.P.S. You may want to create separate DisplayLogin sorry.msg outside <Anonymous> section with "sorry ftp server is only anonymous" text in sorry.msg file.
A simple question,with this configuration I allow anon ftp users. ServerName "ProFTPD Default Installation" ServerType standalone DefaultServer on Port 2121 Umask 022 MaxInstances 30 User ftp Group ftp SystemLog /var/log/proftpd.log TransferLog /var/log/xferlog PassivePorts 49152 65535 UseFtpUsers off <Directory /*> AllowOverwrite on </Directory> <Limit LOGIN> AllowUser ftp AllowUser anonymous DenyAll </Limit> <Anonymous ~ftp> RequireValidShell off User ftp Group ftp # We want clients to be able to login with "anonymous" as well as "ftp" UserAlias anonymous ftp # Limit the maximum number of anonymous logins MaxClients 50 # We want 'welcome.msg' displayed at login, and '.message' displayed # in each newly chdired directory. DisplayLogin welcome.msg DisplayChdir .message # Limit WRITE everywhere in the anonymous chroot <Limit WRITE> DenyAll </Limit> # An upload directory that allows storing files but not retrieving # or creating directories. </Anonymous>But using ftp localhost 21It ask for password My question is: how to disable totally the user login to allow only anonymous? I want an answer like this "sorry ftp server is only anonymous"
Proftpd: total disable user login
There is a second paramter to DefaultRoot ~, a group-expression which may be: DefaultRoot ~ !group_not_chrootedthis means that members of this group won't be chrooted. or DefaultRoot ~ group1this means that only members of these groups will be chrooted. So you can add group for user you don't want to be restricted to their directories or you can add a single group for this user and add this group as a second parameter. Also note: DefaultRoot ~ group1,group2will chroot users who are members of both group1 and group2
I'm have setup a ProFTPd user on my Debian based Nas system for Backups with his default folder. Now I want to ensure that this user only have access to his to his folder. I have read something about it and I have found something that I have to put defaultroot ~ in /etc/proftpd/proftpd.conf. But if I do this all my FTP user has to stay in their home folders is that right? And how to disallow only one user to change from his home folder?
Keep ProFTPD user in his home Folder
Your firewall (router) has a connection tracking helper for FTP. When it sees an FTP control connection (which it recognizes by TCP destination port == 21), it watches the commands. When it sees your client send the PORT command, it rewrites it (to your external IP address, and maybe a different port) and keeps track of the expected connection from the FTP server. When that connection arrives, it's allowed through. When you changed the port, none of that happened, because 10021 isn't recognized as an FTP control connection. On Linux, at least, that feature is the nf_conntrack_ftp module, and you can set the ports option to include 10021 if desired. PS: A similar thing can be done with a firewall in front of the server, though in reverse: it's done on passive-mode transfers, instead of active-mode.
I'm using proftpd on my server (ubuntu 16.04 x86_64). Default proftpd use standart 21 port. I can connect from my home notebook to ftp with active mode without problem. Now I stop proftpd, change port from 21 to 10021, start service again. And now I can not connect with active mode, only with passive mode. What's changed? Also I can not understand, why works active mode? I have internet access by router. I do not forwand any ports to my notebook at router. As I now, on connect, my notebook (ftp client) create connection from some port > 1023 to server port 21. My notebook send to server also second (data) port to server and server connect from own port 20 to me with this data port. But how second connection can established, if my ports are closed from wan?
While stop working active mode FTP after change server port
You can use Port directive: Port <port number>A note that if you set port to N, then you must let port N-1 available too. RFC959 defined that source port for active data transfer must be N-1. You can use Port directive both in server context or virtual server context. Setting Port 0 disable server.
I want to change my ProFTPD server port from 21 to 1945. But I didn't find any port mention in the proftpd.conf file. When I add port 21 in the conf file and restart the ftp server it shows the following error: Starting proftpd (via systemctl): Job failed. See system logs and 'systemctl status' for details. [FAILED]Please help me with finding out how I change my ftp server port. Below is the proftpd.conf file: # This is the ProFTPD configuration file # # See: http://www.proftpd.org/docs/directives/linked/by-name.html# Security-Enhanced Linux (SELinux) Notes: # # In Fedora and Red Hat Enterprise Linux, ProFTPD runs confined by SELinux # in order to mitigate the effects of an attacker taking advantage of an # unpatched vulnerability and getting control of the ftp server. By default, # ProFTPD cannot read or write most files on a system nor connect to many # external network services, but these restrictions can be relaxed by # setting SELinux booleans as follows: # # setsebool -P allow_ftpd_anon_write=1 # This allows the ftp daemon to write to files and directories labelled # with the public_content_rw_t context type; the daemon would only have # read access to these files normally. Files to be made available by ftp # but not writeable should be labelled public_content_t. # # setsebool -P allow_ftpd_full_access=1 # This allows the ftp daemon to read and write all files on the system. # # setsebool -P allow_ftpd_use_cifs=1 # This allows the ftp daemon to read and write files on CIFS-mounted # filesystems. # # setsebool -P allow_ftpd_use_nfs=1 # This allows the ftp daemon to read and write files on NFS-mounted # filesystems. # # setsebool -P ftp_home_dir=1 # This allows the ftp daemon to read and write files in users' home # directories. # # setsebool -P ftpd_connect_all_unreserved=1 # This setting is only available from Fedora 16/RHEL-7 onwards, and is # necessary for active-mode ftp transfers to work reliably with non-Linux # clients (see http://bugzilla.redhat.com/782177), which may choose to # use port numbers outside the "ephemeral port" range of 32768-61000. # # setsebool -P ftpd_connect_db=1 # This setting allows the ftp daemon to connect to commonly-used database # ports over the network, which is necessary if you are using a database # back-end for user authentication, etc. # # setsebool -P ftpd_is_daemon=1 # This setting is available only in Fedora releases 4 to 6 and Red Hat # Enterprise Linux 5. It should be set if ProFTPD is running in standalone # mode, and unset if running in inetd mode. # # setsebool -P ftpd_disable_trans=1 # This setting is available only in Fedora releases 4 to 6 and Red Hat # Enterprise Linux 5, and when set it removes the SELinux confinement of the # ftp daemon. Needless to say, its use is not recommended. # # All of these booleans are unset by default. # # See also the "ftpd_selinux" manpage. # # Note that the "-P" option to setsebool makes the setting permanent, i.e. # it will still be in effect after a reboot; without the "-P" option, the # effect only lasts until the next reboot. # # Restrictions imposed by SELinux are on top of those imposed by ordinary # file ownership and access permissions; in normal operation, the ftp daemon # will not be able to read and/or write a file unless *all* of the ownership, # permission and SELinux restrictions allow it.# Server Config - config used for anything outside a <VirtualHost> or <Global> context # See: http://www.proftpd.org/docs/howto/Vhost.html# Trace logging, disabled by default for performance reasons # (http://www.proftpd.org/docs/howto/Tracing.html) #TraceLog /var/log/proftpd/trace.log #Trace DEFAULT:0ServerName "ProFTPD server" ServerIdent on "FTP Server ready." ServerAdmin root@localhost DefaultServer on# Cause every FTP user except adm to be chrooted into their home directory DefaultRoot ~ !adm# Use pam to authenticate (default) and be authoritative AuthPAMConfig proftpd AuthOrder mod_auth_pam.c* mod_auth_unix.c # If you use NIS/YP/LDAP you may need to disable PersistentPasswd #PersistentPasswd off# Don't do reverse DNS lookups (hangs on DNS problems) UseReverseDNS off# Set the user and group that the server runs as User nobody Group nobody# To prevent DoS attacks, set the maximum number of child processes # to 20. If you need to allow more than 20 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode; in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd) MaxInstances 20# Disable sendfile by default since it breaks displaying the download speeds in # ftptop and ftpwho UseSendfile off# Define the log formats LogFormat default "%h %l %u %t \"%r\" %s %b" LogFormat auth "%v [%P] %h %t \"%r\" %s"# Dynamic Shared Object (DSO) loading # See README.DSO and howto/DSO.html for more details # # General database support (http://www.proftpd.org/docs/contrib/mod_sql.html) # LoadModule mod_sql.c # # Support for base-64 or hex encoded MD5 and SHA1 passwords from SQL tables # (contrib/mod_sql_passwd.html) # LoadModule mod_sql_passwd.c # # Mysql support (requires proftpd-mysql package) # (http://www.proftpd.org/docs/contrib/mod_sql.html) # LoadModule mod_sql_mysql.c # # Postgresql support (requires proftpd-postgresql package) # (http://www.proftpd.org/docs/contrib/mod_sql.html) # LoadModule mod_sql_postgres.c # # Quota support (http://www.proftpd.org/docs/contrib/mod_quotatab.html) # LoadModule mod_quotatab.c # # File-specific "driver" for storing quota table information in files # (http://www.proftpd.org/docs/contrib/mod_quotatab_file.html) # LoadModule mod_quotatab_file.c # # SQL database "driver" for storing quota table information in SQL tables # (http://www.proftpd.org/docs/contrib/mod_quotatab_sql.html) # LoadModule mod_quotatab_sql.c # # LDAP support (requires proftpd-ldap package) # (http://www.proftpd.org/docs/directives/linked/config_ref_mod_ldap.html) # LoadModule mod_ldap.c # # LDAP quota support (requires proftpd-ldap package) # (http://www.proftpd.org/docs/contrib/mod_quotatab_ldap.html) # LoadModule mod_quotatab_ldap.c # # Support for authenticating users using the RADIUS protocol # (http://www.proftpd.org/docs/contrib/mod_radius.html) # LoadModule mod_radius.c # # Retrieve quota limit table information from a RADIUS server # (http://www.proftpd.org/docs/contrib/mod_quotatab_radius.html) # LoadModule mod_quotatab_radius.c # # SITE CPFR and SITE CPTO commands (analogous to RNFR and RNTO), which can be # used to copy files/directories from one place to another on the server # without having to transfer the data to the client and back # (http://www.castaglia.org/proftpd/modules/mod_copy.html) # LoadModule mod_copy.c # # Administrative control actions for the ftpdctl program # (http://www.proftpd.org/docs/contrib/mod_ctrls_admin.html) LoadModule mod_ctrls_admin.c # # Support for MODE Z commands, which allows FTP clients and servers to # compress data for transfer # (http://www.castaglia.org/proftpd/modules/mod_deflate.html) # LoadModule mod_deflate.c # # Execute external programs or scripts at various points in the process # of handling FTP commands # (http://www.castaglia.org/proftpd/modules/mod_exec.html) # LoadModule mod_exec.c # # Support for POSIX ACLs # (http://www.proftpd.org/docs/modules/mod_facl.html) # LoadModule mod_facl.c # # Support for using the GeoIP library to look up geographical information on # the connecting client and using that to set access controls for the server # (http://www.castaglia.org/proftpd/modules/mod_geoip.html) # LoadModule mod_geoip.c # # Allow for version-specific configuration sections of the proftpd config file, # useful for using the same proftpd config across multiple servers where # different proftpd versions may be in use # (http://www.castaglia.org/proftpd/modules/mod_ifversion.html) # LoadModule mod_ifversion.c # # Configure server availability based on system load # (http://www.proftpd.org/docs/contrib/mod_load.html) # LoadModule mod_load.c # # Limit downloads to a multiple of upload volume (see README.ratio) # LoadModule mod_ratio.c # # Rewrite FTP commands sent by clients on-the-fly, # using regular expression matching and substitution # (http://www.proftpd.org/docs/contrib/mod_rewrite.html) # LoadModule mod_rewrite.c # # Support for the SSH2, SFTP, and SCP protocols, for secure file transfer over # an SSH2 connection (http://www.castaglia.org/proftpd/modules/mod_sftp.html) # LoadModule mod_sftp.c # # Use PAM to provide a 'keyboard-interactive' SSH2 authentication method for # mod_sftp (http://www.castaglia.org/proftpd/modules/mod_sftp_pam.html) # LoadModule mod_sftp_pam.c # # Use SQL (via mod_sql) for looking up authorized SSH2 public keys for user # and host based authentication # (http://www.castaglia.org/proftpd/modules/mod_sftp_sql.html) # LoadModule mod_sftp_sql.c # # Provide data transfer rate "shaping" across the entire server # (http://www.castaglia.org/proftpd/modules/mod_shaper.html) # LoadModule mod_shaper.c # # Support for miscellaneous SITE commands such as SITE MKDIR, SITE SYMLINK, # and SITE UTIME (http://www.proftpd.org/docs/contrib/mod_site_misc.html) # LoadModule mod_site_misc.c # # Provide an external SSL session cache using shared memory # (contrib/mod_tls_shmcache.html) # LoadModule mod_tls_shmcache.c # # Provide a memcached-based implementation of an external SSL session cache # (contrib/mod_tls_memcache.html) # LoadModule mod_tls_memcache.c # # Use the /etc/hosts.allow and /etc/hosts.deny files, or other allow/deny # files, for IP-based access control # (http://www.proftpd.org/docs/contrib/mod_wrap.html) # LoadModule mod_wrap.c # # Use the /etc/hosts.allow and /etc/hosts.deny files, or other allow/deny # files, as well as SQL-based access rules, for IP-based access control # (http://www.proftpd.org/docs/contrib/mod_wrap2.html) # LoadModule mod_wrap2.c # # Support module for mod_wrap2 that handles access rules stored in specially # formatted files on disk # (http://www.proftpd.org/docs/contrib/mod_wrap2_file.html) # LoadModule mod_wrap2_file.c # # Support module for mod_wrap2 that handles access rules stored in SQL # database tables (http://www.proftpd.org/docs/contrib/mod_wrap2_sql.html) # LoadModule mod_wrap2_sql.c # # Implement a virtual chroot capability that does not require root privileges # (http://www.castaglia.org/proftpd/modules/mod_vroot.html) # Using this module rather than the kernel's chroot() system call works # around issues with PAM and chroot (http://bugzilla.redhat.com/506735) LoadModule mod_vroot.c # # Provide a flexible way of specifying that certain configuration directives # only apply to certain sessions, based on credentials such as connection # class, user, or group membership # (http://www.proftpd.org/docs/contrib/mod_ifsession.html) # LoadModule mod_ifsession.c# Allow only user root to load and unload modules, but allow everyone # to see which modules have been loaded # (http://www.proftpd.org/docs/modules/mod_dso.html#ModuleControlsACLs) ModuleControlsACLs insmod,rmmod allow user root ModuleControlsACLs lsmod allow user *# Enable basic controls via ftpdctl # (http://www.proftpd.org/docs/modules/mod_ctrls.html) ControlsEngine on ControlsACLs all allow user root ControlsSocketACL allow user * ControlsLog /var/log/proftpd/controls.log# Enable admin controls via ftpdctl # (http://www.proftpd.org/docs/contrib/mod_ctrls_admin.html) <IfModule mod_ctrls_admin.c> AdminControlsEngine on AdminControlsACLs all allow user root </IfModule># Enable mod_vroot by default for better compatibility with PAM # (http://bugzilla.redhat.com/506735) <IfModule mod_vroot.c> VRootEngine on </IfModule># TLS (http://www.castaglia.org/proftpd/modules/mod_tls.html) <IfDefine TLS> TLSEngine on TLSRequired on TLSRSACertificateFile /etc/pki/tls/certs/proftpd.pem TLSRSACertificateKeyFile /etc/pki/tls/certs/proftpd.pem TLSCipherSuite ALL:!ADH:!DES TLSOptions NoCertRequest TLSVerifyClient off #TLSRenegotiate ctrl 3600 data 512000 required off timeout 300 TLSLog /var/log/proftpd/tls.log <IfModule mod_tls_shmcache.c> TLSSessionCache shm:/file=/var/run/proftpd/sesscache </IfModule> </IfDefine># Dynamic ban lists (http://www.proftpd.org/docs/contrib/mod_ban.html) # Enable this with PROFTPD_OPTIONS=-DDYNAMIC_BAN_LISTS in /etc/sysconfig/proftpd <IfDefine DYNAMIC_BAN_LISTS> LoadModule mod_ban.c BanEngine on BanLog /var/log/proftpd/ban.log BanTable /var/run/proftpd/ban.tab # If the same client reaches the MaxLoginAttempts limit 2 times # within 10 minutes, automatically add a ban for that client that # will expire after one hour. BanOnEvent MaxLoginAttempts 2/00:10:00 01:00:00 # Inform the user that it's not worth persisting BanMessage "Host %a has been banned" # Allow the FTP admin to manually add/remove bans BanControlsACLs all allow user ftpadm </IfDefine># Set networking-specific "Quality of Service" (QoS) bits on the packets used # by the server (contrib/mod_qos.html) <IfDefine QOS> LoadModule mod_qos.c # RFC791 TOS parameter compatibility QoSOptions dataqos throughput ctrlqos lowdelay # For a DSCP environment (may require tweaking) #QoSOptions dataqos CS2 ctrlqos AF41 </IfDefine># Global Config - config common to Server Config and all virtual hosts # See: http://www.proftpd.org/docs/howto/Vhost.html <Global> # Umask 022 is a good standard umask to prevent new dirs and files # from being group and world writable Umask 022 # Allow users to overwrite files and change permissions AllowOverwrite yes <Limit ALL SITE_CHMOD> AllowAll </Limit> DefaultRoot ~</Global># A basic anonymous configuration, with an upload directory # Enable this with PROFTPD_OPTIONS=-DANONYMOUS_FTP in /etc/sysconfig/proftpd <IfDefine ANONYMOUS_FTP> <Anonymous ~ftp> User ftp Group ftp AccessGrantMsg "Anonymous login ok, restrictions apply." # We want clients to be able to login with "anonymous" as well as "ftp" UserAlias anonymous ftp # Limit the maximum number of anonymous logins MaxClients 10 "Sorry, max %m users -- try again later" # Put the user into /pub right after login #DefaultChdir /pub # We want 'welcome.msg' displayed at login, '.message' displayed in # each newly chdired directory and tell users to read README* files. DisplayLogin /welcome.msg DisplayChdir .message DisplayReadme README* # Cosmetic option to make all files appear to be owned by user "ftp" DirFakeUser on ftp DirFakeGroup on ftp # Limit WRITE everywhere in the anonymous chroot <Limit WRITE SITE_CHMOD> DenyAll </Limit> # An upload directory that allows storing files but not retrieving # or creating directories. <Directory uploads/*> AllowOverwrite no <Limit READ> DenyAll </Limit> <Limit STOR> AllowAll </Limit> </Directory> # Don't write anonymous accesses to the system wtmp file (good idea!) WtmpLog off # Logging for the anonymous transfers ExtendedLog /var/log/proftpd/access.log WRITE,READ default ExtendedLog /var/log/proftpd/auth.log AUTH auth </Anonymous> </IfDefine><VirtualHost 192.168.0.4> ServerName esdev.wiantech.net <Anonymous /home/esdev/ftp> User ftp Group ftp UserAlias anonymous ftp <Limit WRITE> DenyAll </Limit> RequireValidShell off ExtendedLog /home/esdev/logs/ftp.log </Anonymous> </VirtualHost> <VirtualHost 122.176.97.151> </VirtualHost> <VirtualHost 122.176.97.151> ServerName "klarify15.wiantech.net" </VirtualHost> <VirtualHost 122.176.97.151> ServerName "klarify15.wiantech.net" </VirtualHost>
How to change the ftp server port in ProFTPD
Looks like probably epel on your machine is not enabled. Even though you installed it, you may have to enable it manually. Check /etc/yum.repos.d/ for epel.repo file and set it to enabled=1 if it's not already. As per your finding, check also /etc/yum.repos.d/archive, as the file may be put there by the package installation.
I am having difficulty installing proftp or pureftp on centos 6. I have followed the typical instructions (alternatively) which go like this # Add EPL repository rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm# Install yum install proftpd# Alternatively yum install pure-ftpdThe result is the same Loaded plugins: auto-update-debuginfo, fastestmirror, refresh-packagekit, security Setting up Install Process Loading mirror speeds from cached hostfile * base: centos.mirroring.pulsant.co.uk * extras: mirrors.clouvider.net * updates: centos.mirroring.pulsant.co.uk No package proftpd available. Error: Nothing to doOr as the case may be No package pure-ftpd available.
Unable to install proftp or pureftp on centos 6 (typical instructions don't work)
Exactly the same thing happened to me after upgrading from Precise Pangolin to Trusty Tahr. I investigated and it looks like /etc/vsftpd.conf, the FTP configuration file, was one of the configuration files amended during the upgrade. Specifically, this line: write_enable=YESwhich I had previously uncommented was now commented again. I uncommented it, restarted the FTP server (sudo restart vsftpd) and suddenly I could upload and amend file permissions again.
uploaded file via filezilla to proftp server(on ubuntu 14.04 lts) but reported 550 error 550 download.html: Permission denied Error: Critical file transfer errorI try to set the directory to chmod 777 but error is same ftp for download is OK your comment welcome
uploaded file via filezilla to proftp server(on ubuntu 14.04 lts) but reported 550 error
Here's several problem I can already identify: #AuthOrder does not mention mod_sql.c so it will never use mysql to identify your users. AuthOrder mod_sql.c mod_auth_pam.c mod_auth_unix.c#this code shouldn't be commented in your config file and should look like this or you will never enable sql_mod <IfModule mod_dso.c> LoadModule mod_sql.c LoadModule mod_sql_mysql.c # LoadModule mod_sql_postgres.c </IfModule>#Mysql is not used without a port, you should verify this parameter (also the password is weak but lets keep that for another moment) SQLConnectInfo proftpd@localhost:PORT root root#are you sure to use the correct password encryption (but that would be a problem to deal with later) SQLAuthTypes Crypt BackendAlso keep in mind that this virtual user needs to be bind to a real one that has the correct permission. Finally if you need to debug the daemon, you can just add those 2 directives at the very top of your configuration file : Trace DEFAULT:10 TraceLog /var/ftpd/trace.log
I have installed prftpd and proftpd-mysql rpm on a linux machine. Intention is to have usermanagement of ftpusers via web. So I have installed proftpadmin from Here Now when I am adding the below lines in /etc/proftpd.conf file SQLConnectInfo proftpd@localhost root root SQLAuthenticate users groups SQLAuthTypes Crypt Backend SQLUserInfo users userid passwd uid gid homedir shell SQLGroupInfo groups groupid gid members SQLLog PASS logincount SQLNamedQuery logincount UPDATE "login_count=login_count+1 WHERE userid='%u'" users SQLLog PASS lastlogin SQLNamedQuery lastlogin UPDATE "last_login=now() WHERE userid='%u'" users SQLLog RETR dlbytescount SQLNamedQuery dlbytescount UPDATE "dl_bytes=dl_bytes+%b WHERE userid='%u'" users SQLLog RETR dlcount SQLNamedQuery dlcount UPDATE "dl_count=dl_count+1 WHERE userid='%u'" users SQLLog STOR ulbytescount SQLNamedQuery ulbytescount UPDATE "ul_bytes=ul_bytes+%b WHERE userid='%u'" users SQLLog STOR ulcount SQLNamedQuery ulcount UPDATE "ul_count=ul_count+1 WHERE userid='%u'" users SQLUserWhereClause "disabled!=1"service proftpd start fails . If I remove those lines service starts, I cannot manage users via mysql, as above lines are mendatory. Can anyone please suggest where I am going wrong Please find my below /etc/proftpd.conf file # This is the ProFTPD configuration file # $Id: proftpd.conf,v 1.1 2004/02/26 17:54:30 thias Exp $ServerName "ProFTPD server" ServerIdent on "FTP Server ready." ServerAdmin root@localhost ServerType standalone #ServerType inetd DefaultServer on AccessGrantMsg "User %u logged in." #DisplayConnect /etc/ftpissue #DisplayLogin /etc/ftpmotd #DisplayGoAway /etc/ftpgoaway DeferWelcome off# Use this to excude users from the chroot DefaultRoot ~ !adm# Use pam to authenticate (default) and be authoritative #AuthPAMConfig proftpd AuthOrder mod_auth_pam.c* mod_auth_unix.c# Do not perform ident nor DNS lookups (hangs when the port is filtered) IdentLookups off UseReverseDNS off# Port 21 is the standard FTP port. Port 21# Umask 022 is a good standard umask to prevent new dirs and files # from being group and world writable. Umask 022# Default to show dot files in directory listings ListOptions "-a"# See Configuration.html for these (here are the default values) #MultilineRFC2228 off #RootLogin off #LoginPasswordPrompt on #MaxLoginAttempts 3 #MaxClientsPerHost none #AllowForeignAddress off # For FXP# Allow to resume not only the downloads but the uploads too AllowRetrieveRestart on AllowStoreRestart on# To prevent DoS attacks, set the maximum number of child processes # to 30. If you need to allow more than 30 concurrent connections # at once, simply increase this value. Note that this ONLY works # in standalone mode, in inetd mode you should use an inetd server # that allows you to limit maximum number of processes per service # (such as xinetd) MaxInstances 20# Set the user and group that the server normally runs at. User nobody Group nobody# Disable sendfile by default since it breaks displaying the download speeds in # ftptop and ftpwho UseSendfile no# This is where we want to put the pid file ScoreboardFile /var/run/proftpd.score# Normally, we want users to do a few things. <Global> AllowOverwrite yes <Limit ALL SITE_CHMOD> AllowAll </Limit> </Global># Define the log formats LogFormat default "%h %l %u %t \"%r\" %s %b" LogFormat auth "%v [%P] %h %t \"%r\" %s"# TLS # Explained at http://www.castaglia.org/proftpd/modules/mod_tls.html #TLSEngine on #TLSRequired on #TLSRSACertificateFile /etc/pki/tls/certs/proftpd.pem #TLSRSACertificateKeyFile /etc/pki/tls/certs/proftpd.pem #TLSCipherSuite ALL:!ADH:!DES #TLSOptions NoCertRequest #TLSVerifyClient off ##TLSRenegotiate ctrl 3600 data 512000 required off timeout 300 #TLSLog /var/log/proftpd/tls.log# SQL authentication Dynamic Shared Object (DSO) loading # See README.DSO and howto/DSO.html for more details. #<IfModule mod_dso.c> # LoadModule mod_sql.c # LoadModule mod_sql_mysql.c # LoadModule mod_sql_postgres.c #</IfModule># A basic anonymous configuration, with an upload directory. #<Anonymous ~ftp> # User ftp # Group ftp # AccessGrantMsg "Anonymous login ok, restrictions apply." # # # We want clients to be able to login with "anonymous" as well as "ftp" # UserAlias anonymous ftp # # # Limit the maximum number of anonymous logins # MaxClients 10 "Sorry, max %m users -- try again later" # # # Put the user into /pub right after login # #DefaultChdir /pub # # # We want 'welcome.msg' displayed at login, '.message' displayed in # # each newly chdired directory and tell users to read README* files. # DisplayLogin /welcome.msg # DisplayFirstChdir .message # DisplayReadme README* # # # Some more cosmetic and not vital stuff # DirFakeUser on ftp # DirFakeGroup on ftp # # # Limit WRITE everywhere in the anonymous chroot # <Limit WRITE SITE_CHMOD> # DenyAll # </Limit> # # # An upload directory that allows storing files but not retrieving # # or creating directories. # <Directory uploads/*> # AllowOverwrite no # <Limit READ> # DenyAll # </Limit> # # <Limit STOR> # AllowAll # </Limit> # </Directory> # # # Don't write anonymous accesses to the system wtmp file (good idea!) # WtmpLog off # # # Logging for the anonymous transfers # ExtendedLog /var/log/proftpd/access.log WRITE,READ default # ExtendedLog /var/log/proftpd/auth.log AUTH auth # #</Anonymous>SQLConnectInfo proftpd@localhost root root SQLAuthenticate users groups SQLAuthTypes Crypt Backend SQLUserInfo users userid passwd uid gid homedir shell SQLGroupInfo groups groupid gid members SQLLog PASS logincount SQLNamedQuery logincount UPDATE "login_count=login_count+1 WHERE userid='%u'" users SQLLog PASS lastlogin SQLNamedQuery lastlogin UPDATE "last_login=now() WHERE userid='%u'" users SQLLog RETR dlbytescount SQLNamedQuery dlbytescount UPDATE "dl_bytes=dl_bytes+%b WHERE userid='%u'" users SQLLog RETR dlcount SQLNamedQuery dlcount UPDATE "dl_count=dl_count+1 WHERE userid='%u'" users SQLLog STOR ulbytescount SQLNamedQuery ulbytescount UPDATE "ul_bytes=ul_bytes+%b WHERE userid='%u'" users SQLLog STOR ulcount SQLNamedQuery ulcount UPDATE "ul_count=ul_count+1 WHERE userid='%u'" users SQLUserWhereClause "disabled!=1"SQL Script looks as below which is updated on respective Database # # Table structure for table `groups` #CREATE TABLE `groups` ( `groupid` varchar(10) NOT NULL default '', `gid` int(10) unsigned NOT NULL auto_increment, `members` varchar(255) NOT NULL default '', PRIMARY KEY (`gid`) ) TYPE=InnoDB ;# # Table structure for table `users` #CREATE TABLE `users` ( `id` smallint(2) NOT NULL auto_increment, `userid` varchar(10) NOT NULL default '', `uid` int(10) unsigned NOT NULL default '', `gid` int(10) unsigned NOT NULL default '', `passwd` varchar(255) NOT NULL default '', `homedir` varchar(255) NOT NULL default '', `comment` varchar(255) NOT NULL default '', `disabled` int(10) unsigned NOT NULL default '0', `shell` varchar(20) NOT NULL default '/sbin/nologin', `email` varchar(255) NOT NULL default '', `name` varchar(255) NOT NULL default '', `ul_bytes` bigint(20) NOT NULL default '0', `dl_bytes` bigint(20) NOT NULL default '0', `login_count` bigint(20) NOT NULL default '0', `dl_count` bigint(20) NOT NULL default '0', `ul_count` bigint(20) NOT NULL default '0', `last_login` datetime default NULL, PRIMARY KEY (`id`) ) TYPE=InnoDB ;
proftpd via mysql & web management of FTP users