Hot answers tagged

7

Well, if you know your IP starts with 10.16, it's trivial: ifconfig -a | grep -oP '\b10\.16\.[0-9.]+\b' Or, if your grep doesn't support -P or -o: ifconfig -a | awk '/10\.16\./ && /inet/{print $2}' If not, you could find all lines starting with inet and print their second field: ifconfig -a | awk '$1=="inet"{print $2}' That, however, would ...


5

You have only Link-Local, non routable ipv6 (fe80::/10). So You have no public routable IPv6. In this configuration You can make ipv6 connect only to Link-Local addresses in same L2 segment.


4

The problem with handling this by changing login shell, as in your example, is that when user connects to sshd in the main network namespace then even if you get their shell to run inside another namespace but their port forwarding will operate in the default network namespace anyway. My proposed solution also addresses containing port forwarding to the ...


4

Yes , You have lot of options/tools to use. I just tried this , it works: ifconfig | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" so you can use grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b" to grep the ip addresses from your output.


3

You might need to specify the subnet mask to use. The command above is likely assuming that the subnet mask is 255.255.255.255, which is for a point-to-point network. The following might work: sudo ifconfig wlp3s0 down sudo ifconfig wlp3s0 192.168.1.12/255.255.255.0 sudo ifconfig wlp3s0 up (Also check to see that a default route is present, using the ip ...


3

on each node, check: cat /proc/sys/net/ipv4/icmp_echo_ignore_all if it is 1, change to 0: echo 0 >/proc/sys/net/ipv4/icmp_echo_ignore_all


2

The most common reason why you get a bogus IP address for a nonexistent domain is that your ISP converts negative answers into the address of their ad servers, to serve you more ads when you make a typo in the address of a website. This is definitely a shady practice, but unfortunately some ISPs do it. You can commonly counter that by using different ...


2

You can use either host or nslookup from bind-tools: $ host 172.217.19.195 195.19.217.172.in-addr.arpa domain name pointer fra02s21-in-f3.1e100.net. $ nslookup 172.217.19.195 Server: 192.168.2.1 Address: 192.168.2.1#53 Non-authoritative answer: 195.19.217.172.in-addr.arpa name = fra02s21-in-f3.1e100.net.


2

To ping using IPv6 you have to use the following command: ping6 example.com But even currently you only have a link-local address so that will not work. You need a IPv6 address that is routable to be able to ping outwards.


2

If your file is called e.g ips you can write somethinng like: while read -r ip do if [[ $ip == "$1" ]]; then shift printf '%s\n' 'action to take if match found' else printf '%s\n' 'action to take if match not found' fi done < ips Then you can pass the parameters as follow the the ...


2

It's a little unclear what you want, but here goes: ping usually shows what ip it's using. That might be the address on your LAN side of the router, but that is most likely what you need. If you're looking for the address on the WAN side, you can try visiting sites like http://whatismyip.com, but if your ISP uses CGN (Carrier Grade NAT) the reported IP ...


1

The IP 169.254.169.254 is in the network block 168.254.0.0/16 allocated for Automatic Private IP Addressing. It should never be routed to the internet. If your IP address is in the block you will not have direct connectivity to the internet. However, you may be able to use a proxy to connect to sites on the internet. There are a number of mechanisms ...


1

There are a few things to point out about your question's content which should answer you: An IP address does not generate a DNS lookup. It simply generates a connection request that gets routed. The existence of a proxy server on any system does not in itself decide what happens with the traffic. What does is the routing table and firewall rules. The ...


1

If you are sending very small quantities of data at a time then it could happen: For every transmit you will receive an ack, possibly with zero byte payload. For every receive you will transmit an ack, possibly with zero byte payload. For every new connection you will transmit/receive a syn, a syn/ack, and an ack. (probably all with zero payload) There ...


1

starting my answer based on this answer: Yes , You have lot of options/tools to use. I just tried this , it works: ifconfig | grep -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" a so you can use grep -oE "\b([0-9]{1,3}.){3}[0-9]{1,3}\b" to grep the ip addresses from your output. and converting the answer to full length IPv6, etc...: fgrep -oE "\b([...


1

Redirect that output to some outputFile Simply grep it with pattern as, grep -sE "159.143.23.12|134.12.178.131|124.143.12.132" <outputFile>


1

The host utility will return a string containing the resolved host name: $ host 8.8.8.8 8.8.8.8.in-addr.arpa domain name pointer google-public-dns-a.google.com. This ought to be fairly easy to parse in any shell script. If the host name lookup fails, host exits with a non-zero exit status: $ if ! host 8.8.8.1 2>/dev/null; then echo "lookup failed"; ...


1

Use an OpenWrt device with a hardware button or serial port for configuration experiments. Then if the device becomes inaccessible due to configuration error, you can boot it in failsafe mode and follow documented proceedures to restore a known-good configuration. https://wiki.openwrt.org/doc/howto/generic.failsafe https://wiki.openwrt.org/doc/howto/...


1

Here you are: ifconfig -a | grep -e "inet [0-9]" | cut -d" " -f 2 Most of the given answers won't work well on Mac OS X! The easiest thing you can do, is using cut or awk.


1

Use ip addr show with -o flag. For instance, here's all IPv4 addresses of my connected interfaces $ ip -4 -o addr show | awk '{print $4}' 127.0.0.1/8 10.42.0.1/24 192.168.0.78/24 10.0.3.1/24 Getting only specific addresses that start with 10. like you have can be done this ...


1

To get all inet IP: ifconfig -a | grep -oP 'inet \K\S+' In order to get just 10.16 family: ifconfig -a | grep -oP 'inet \K10\.16\S+'


1

$ sed -E -e 's/[[:space:];#\/].*//; /\.0$+|[0-9a-f]{1,4}:|^[[:space:]]*$/d' spamhaus.txt 129.130.100.100 1.160.118.30 91.121.120.228 62.210.111.59 52.90.253.169 (newline and indentation added to improve readability) remove comments and everything from the first whitespace on a line (i.e. replace with the empty string) delete lines ...


1

Just specify that you don't allow 0s at the end in your regex: $ grep -o '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[1-9][0-9]*' file 129.130.100.100 1.160.118.30 91.121.120.228 62.210.111.59 52.90.253.169 The trick is the \.[1-9][0-9]*, which means match a ., then any number greater than 0 once (you can't have IPs ending in 019 or similar numbers) and ...


1

You can do the entire task with awk (assumes the pathname, of course): #!/usr/bin/awk -f /^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[1-9][0-9]*$/ { print; next; } /^[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[1-9][0-9]*[^0-9\.:].*$/ { sub("[^0-9.].*$",""); print; } The first pattern matches just an IPv4 (no following text), and ...


1

In the /etc/sysconfig/network-scripts/ifcfg-eth0change BOOTPROTO to none instead of static then restart network using systemctl restart network BOOTPROTO doesn't support static, it should be either none, bootp or dhcp https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-networkscripts-interfaces.html


1

It would help to know the Unix or Unix-like O/S and version because software and file locations can differ. If I understand the problem, you want each machine to have WAN access using eth0 and LAN access using eth1. For any Linux, make a new routing table for eth1, naming the network "mgmt", or whichever name you like. echo '200 mgmt' >> /etc/...


1

Four interfaces(say eth1, eth2,eth3,eth4) are configured with different subnet IP addresses in my LINUX server, so does that mean are there four NIC cards in In my server?. Maybe. More likely on a server are that number of ports are on the main board. In servers dual and quad port cards are also common, so the number of NIC cards can be anywhere between ...



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