Hot answers tagged

22 votes

Can I prevent a default route being added when bringing up an interface?

I faced similar problem on Raspbian (I suppose the solution below will be applicable to Debian as well). Raspberry Pi 3 has 2 NICs integrated: Wi-Fi and Ethernet. I use both of them, they are wlan0 ...
Roman Me's user avatar
  • 361
18 votes
Accepted

Bash: Extract one of the four sections of an IPv4 address

Assuming the default value of IFS you extract each octet into it's own variable with: read A B C D <<<"${IP//./ }" Or into an array with: A=(${IP//./ })
Jason Musgrove's user avatar
13 votes
Accepted

wget uses ipv6 address and takes too long to complete

curl and wget do not use different mechanisms for resolving domains (they're using getaddrinfo()). However, curl implements a fast fallback algorithm to improve the user experience in cases where IPv6 ...
user234931's user avatar
12 votes

Add IPv6 address to existing IPv4 interface not working

Your ifup probably doesn't run because the interface already has the IPv4 address and it can't add it twice. It will not even reach the IPv6 line. If you can you should bring the interface down so all ...
Sander Steffann's user avatar
9 votes

Can I prevent a default route being added when bringing up an interface?

On RHEL6/Fedora 22 the following has been tested. In /etc/sysconfig/network-scripts/ifcfg-eth1 add the line: DEFROUTE=no Replace eth1 with name of interface where default routing is not wanted. ...
user3489409's user avatar
9 votes
Accepted

does :::80 in netstat output means only ipv6 or ipv6+ipv4?

A listening socket that is bound to ::, i.e. any address IPv6 address (INADDR6_ANY), may or may not also listen to connections using IPv4. This depends from several things: Some operating systems are ...
Johan Myréen's user avatar
8 votes

Bash: Extract one of the four sections of an IPv4 address

Your problem statement may be a bit more liberal than you intended.  At the risk of exploiting a loophole, here’s the solution muru alluded to: first=${IP%%.*} last3=${IP#*.} second=${last3%%.*} ...
G-Man Says 'Reinstate Monica''s user avatar
8 votes

Bash: Extract one of the four sections of an IPv4 address

I do realize that you specifically asked for a solution that DID NOT temporarily redefine IFS, but I have a sweet and simple solution that you didn't cover, so here goes: IFS=. ; set -- $IP That ...
user1404316's user avatar
  • 3,068
6 votes
Accepted

How can I get the ipv4 address from `ip link` like I used to see with ifconfig?

Apparently ip broke up the MAC address (now in the ip link (device) interface), and the network ip address. The command ip address is what shows the network addresses, 1: lo: <LOOPBACK,UP,LOWER_UP&...
Evan Carroll's user avatar
  • 30.4k
5 votes
Accepted

IPv6 over TCP or TCP6

TCP4 or TCP6 procotols don't exist. They can be used as a shorthand to indicate respectively TCP with IPv4 and TCP with IPv6, but that's an abuse of language -- the protocol used is always TCP. Due ...
dr_'s user avatar
  • 29.4k
5 votes

Bash: Extract one of the four sections of an IPv4 address

Not the easiest, but you could do something like: $ IP=109.96.77.15 $ echo "$((${-+"(${IP//./"+256*("}))))"}&255))" 109 $ echo "$((${-+"(${IP//./"+256*("}))))"}>>8&255))" 96 $ echo "$(($...
Stéphane Chazelas's user avatar
5 votes

`dig -4` returns IPv6 address

This is you not doing things properly. ☺ The reported -c IN effect is because you didn't do that right. Both queries were clearly IN, as that is the default class anyway. But notice that the one that ...
JdeBP's user avatar
  • 68.4k
5 votes

IP fragments are not reassembled due to packet loss in Linux

Some fragments are getting lost for whatever reason. This is not a reassembly issue and no amount of fiddling with timeouts is going to fix it. What you see in Wireshark (or any pcap-based tool) is ...
TooTea's user avatar
  • 2,378
4 votes

Validating IP addresses (IPv4 and IPv6)

How about using ip command; ip route get <ip-address> If it's not valid, the return value would be 1. (2022/9/17) To answer @MaXi32's comment, I quickly checked this on my Linux laptop without ...
ktaka's user avatar
  • 128
4 votes
Accepted

Fedora Core 4 won't get an IPV4 address

It's possible that the lightning strike destroyed the network port on your machine, and that the IPv6 address is a self-assigned address. Have you tried using the 'ping6' command to try pinging an ...
jsmith's user avatar
  • 66
4 votes

What is ICMP reply for all-zero host-bit IPv4 address?

If you check RFC 1812 you will read this: 4.2.3.1 IP Broadcast Addresses (2) SHOULD silently discard on receipt (i.e., do not even deliver to applications in the router) any packet ...
Romeo Ninov's user avatar
  • 17.3k
4 votes

Using Linux as router with nftables - masquerade not forwarding reply back

The nftables wiki states: "[...] you have to register the prerouting/postrouting chains even if you have no rules there since these chain will invoke the NAT engine for the packets coming in the ...
Gongjin's user avatar
  • 41
4 votes

Bash: Extract one of the four sections of an IPv4 address

With zsh, you can nest parameter substitutions: $ ip=12.34.56.78 $ echo ${${ip%.*}##*.} 56 $ echo ${${ip#*.}%%.*} 34 This is not possible in bash.
muru's user avatar
  • 72.3k
4 votes

Bash: Extract one of the four sections of an IPv4 address

Sure, let's play the elephant game. $ ipsplit() { local IFS=.; ip=(.$*); } $ ipsplit 10.1.2.3 $ echo ${ip[1]} 10 or $ ipsplit() { local IFS=.; echo $*; } $ set -- `ipsplit 10.1.2.3` $ echo $1 10
jthill's user avatar
  • 2,710
4 votes
Accepted

Ip address is of 32 bit, which means 4 bytes. Yet all answers to question on 13 root dns servers say otherwise

"... As each IPv4 address requires 32 bytes, having 13 servers uses 416 bytes, leaving up to 96 bytes for the remaining protocol information." The DNS protocol never transmits just plain IP addresses,...
telcoM's user avatar
  • 94.6k
4 votes
Accepted

Router with nftables doesn't work well

The firewall rules did not cause the problem. Instead, it's due to the MTU difference in "plain" Ethernet and PPPoE. Since PPP header takes up (at least) 8 bytes, and the usual MTU of ...
Tom Yan's user avatar
  • 731
4 votes
Accepted

How do packets flow through the kernel

Most folks I know who are working with the Linux network stack use the below diagram (which you can find on Wikipedia under CC BY-SA 3.0 license). As you can see, in addition to the netfilter hooks, ...
pchaigno's user avatar
  • 301
4 votes

debian 8: My machine started to only use IPv6 for *outgoing* connections. How to go back to IPv4?

Another method that might work would be to configure your machine to prefer IPv4. So it'll try IPv4 first but then try IPv6 if that fails. This can be done in /etc/gai.conf precedence ::ffff:0:0/96 ...
Stephen Harris's user avatar
4 votes
Accepted

dhcpd or dhclient not found

If you receive command not found when trying to run dhcp or dhclient, it's possible that these are not installed. To install the DHCP client utilities run: sudo apt install isc-dhcp-client This will ...
Z0OM's user avatar
  • 3,099
3 votes

Mapping IPv6 to IPv4 addresses

I am going to assume that by "map IPv6 to IPv4 addresses on a local network" you mean "find an IPv6 address that some host is using given an IPv4 address it is using", or vice versa. Your method of ...
Celada's user avatar
  • 44k
3 votes

Find local processes starting TCP connections

Assuming you have SystemTap installed probe begin { printf("ok\n"); } probe syscall.connect { # connect however may fail or flail around in a EINPROGRESS state; # this log only indicates ...
thrig's user avatar
  • 34.9k

Only top scored, non community-wiki answers of a minimum length are eligible