Can't connect to localhost after upgrading to El Capitan - apache

After updating to El Capitan I can't access localhost.
Another computer where El Capitan was already at the installation of MAMP everything works fine.
Both Apache and MySQL server start ,but can't get to localhost page
This is what I've tried so far:
1) Uncommented some of the lines on httpd.conf as indicated on some messages
2) Replaced current files with files in private/etc/apache2/original
3) Copied http.conf and extra/ from the other computer (the one where localhost is working)
4) Tried different ports configuration (Apache: 8888 & MySql: 8889)
Since none of the above worked, I put back files to the original state (i.e. before uncommenting or replacing)
Finally, if instead of localhost I type computer_name.local/ on the browser address bar I can see my files.
I am VERY new with all this, any suggestions?
Thanks,
S
Denis, thanks for the suggestion. These are the results from Terminal:
lo0: flags=8049 mtu 16384
options=3
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=1
gif0: flags=8010 mtu 1280
stf0: flags=0<> mtu 1280
en1: flags=8823 mtu 1500
ether 88:63:df:cb:a5:39
nd6 options=1
media: autoselect ()
status: inactive
en0: flags=8863 mtu 1500
options=10b
ether ac:87:a3:14:72:1b
nd6 options=1
media: autoselect (none)
status: inactive
en2: flags=963 mtu 1500
options=60
ether 0a:00:00:3c:bc:00
media: autoselect
status: inactive
en3: flags=963 mtu 1500
options=60
ether 0a:00:00:3c:bc:01
media: autoselect
status: inactive
en5: flags=8863 mtu 1500
options=10b
ether 40:6c:8f:38:4f:a5
inet6 fe80::426c:8fff:fe38:4fa5%en5 prefixlen 64 scopeid 0x8
inet 192.168.1.21 netmask 0xffffff00 broadcast 192.168.1.255
nd6 options=1
media: autoselect (1000baseT )
status: active
en7: flags=8863 mtu 1460
ether 02:50:f2:00:00:01
nd6 options=1
media: autoselect
status: inactive
p2p0: flags=8802 mtu 2304
ether 0a:63:df:cb:a5:39
media: autoselect
status: inactive
bridge0: flags=8863 mtu 1500
options=63
ether 8a:63:df:bc:63:00
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en2 flags=3
ifmaxaddr 0 port 6 priority 0 path cost 0
member: en3 flags=3
ifmaxaddr 0 port 7 priority 0 path cost 0
nd6 options=1
media:
status: inactive
awdl0: flags=8902 mtu 1484
ether 52:4f:2b:35:96:9d
nd6 options=1
media: autoselect
status: inactive

Related

Redis sentinel node can not sync after failover

We have setup Redis with sentinel high availability using 3 nodes. Suppose fist node is master, when we reboot first node, failover happens and second node becomes master, until this point every thing is OK. But when fist node comes back it cannot sync with master and we saw that in its config no "masterauth" is set.
Here is the error log and Generated by CONFIG REWRITE config:
1182:S 29 May 2021 13:49:42.713 * Reconnecting to MASTER 192.168.1.2:6379 after failure
1182:S 29 May 2021 13:49:42.716 * MASTER <-> REPLICA sync started
1182:S 29 May 2021 13:49:42.716 * Non blocking connect for SYNC fired the event.
1182:S 29 May 2021 13:49:42.717 * Master replied to PING, replication can continue...
1182:S 29 May 2021 13:49:42.717 * (Non critical) Master does not understand REPLCONF listening-port: -NOAUTH Authentication required.
1182:S 29 May 2021 13:49:42.717 * (Non critical) Master does not understand REPLCONF capa: -NOAUTH Authentication required.
1182:S 29 May 2021 13:49:42.717 * Partial resynchronization not possible (no cached master)
1182:S 29 May 2021 13:49:42.718 # Unexpected reply to PSYNC from master: -NOAUTH Authentication required.
1182:S 29 May 2021 13:49:42.718 * Retrying with SYNC...
# Generated by CONFIG REWRITE
save 3600 1
save 300 100
save 60 10000
user default on #eb5fbb922a75775721db681c49600c069cf686765eeebaa6e18fad195812140d ~* &* +#all
replicaof 192.168.1.2 6379
What is the problem?
Config Sample:
bind 127.0.0.1 -::1 192.168.1.3
protected-mode yes
port 6379
tcp-backlog 511
timeout 0
tcp-keepalive 300
daemonize yes
supervised systemd
pidfile "/var/run/redis_6379.pid"
loglevel notice
logfile ""
databases 16
always-show-logo no
set-proc-title yes
proc-title-template "{title} {listen-addr} {server-mode}"
stop-writes-on-bgsave-error yes
rdbcompression yes
rdbchecksum yes
dbfilename "dump.rdb"
rdb-del-sync-files no
dir "/"
replicaof 192.168.1.2 6379
masterauth "redis"
replica-serve-stale-data yes
replica-read-only yes
repl-diskless-sync no
repl-diskless-sync-delay 5
repl-diskless-load disabled
repl-disable-tcp-nodelay no
replica-priority 100
acllog-max-len 128
requirepass "redis"
lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no
lazyfree-lazy-user-del no
lazyfree-lazy-user-flush no
oom-score-adj no
oom-score-adj-values 0 200 800
disable-thp yes
appendonly no
appendfilename "appendonly.aof"
appendfsync everysec
no-appendfsync-on-rewrite no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb
aof-load-truncated yes
aof-use-rdb-preamble yes
lua-time-limit 5000
slowlog-log-slower-than 10000
slowlog-max-len 128
latency-monitor-threshold 0
notify-keyspace-events ""
hash-max-ziplist-entries 512
hash-max-ziplist-value 64
list-max-ziplist-size -2
list-compress-depth 0
set-max-intset-entries 512
zset-max-ziplist-entries 128
zset-max-ziplist-value 64
hll-sparse-max-bytes 3000
stream-node-max-bytes 4kb
stream-node-max-entries 100
activerehashing yes
client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60
hz 10
dynamic-hz yes
aof-rewrite-incremental-fsync yes
rdb-save-incremental-fsync yes
jemalloc-bg-thread yes
For those who may run into same problem, problem was REDIS misconfiguration, after third deployment we carefully set parameters and no problem was found.

OpenNebula - Bridge VM NIC with Host NIC - take Ip from LAN DCHP

I hope you are doing well,
I start using OpenNebula here, I deploy a basic setup one Opennebula fronend in centos 8
another server as OpenNebula Node,
I download an image from marketplace it's centos image, Then I create a network Under Network >> Virual Network. Bridge it with ens33 (ens3 is the physical interface of my node) in order to give VM access to LAN,
he is my Node net
[centos#host1 ~]$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.0.60 netmask 255.255.255.0 broadcast 192.168.0.255
ether 00:0c:29:68:26:2b txqueuelen 1000 (Ethernet)
RX packets 679155 bytes 994474147 (948.4 MiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 41914 bytes 3220552 (3.0 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 6 bytes 672 (672.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 6 bytes 672 (672.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
virbr0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
inet 192.168.122.1 netmask 255.255.255.0 broadcast 192.168.122.255
ether 52:54:00:89:84:b1 txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
once I create a VM and attach it to the bridge network I create already, i get status Failed with the bellow log :
Sat May 1 03:50:25 2021 [Z0][VM][I]: New state is ACTIVE
Sat May 1 03:50:25 2021 [Z0][VM][I]: New LCM state is PROLOG
Sat May 1 03:50:38 2021 [Z0][VM][I]: New LCM state is BOOT
Sat May 1 03:50:38 2021 [Z0][VMM][I]: Generating deployment file: /var/lib/one/vms/14/deployment.0
Sat May 1 03:50:39 2021 [Z0][VMM][I]: Successfully execute transfer manager driver operation: tm_context.
Sat May 1 03:50:40 2021 [Z0][VMM][I]: Command execution fail: cat << EOT | /var/tmp/one/vnm/bridge/pre
Sat May 1 03:50:40 2021 [Z0][VMM][E]: pre: Command "sudo ip link add name ens33 type bridge " failed.
Sat May 1 03:50:40 2021 [Z0][VMM][E]: pre: RTNETLINK answers: File exists
Sat May 1 03:50:40 2021 [Z0][VMM][E]: RTNETLINK answers: File exists
Sat May 1 03:50:40 2021 [Z0][VMM][E]:
Sat May 1 03:50:40 2021 [Z0][VMM][I]: ExitCode: 2
Sat May 1 03:50:40 2021 [Z0][VMM][I]: Failed to execute network driver operation: pre.
Sat May 1 03:50:40 2021 [Z0][VMM][E]: Error deploying virtual machine: bridge: RTNETLINK answers: File exists
Sat May 1 03:50:40 2021 [Z0][VM][I]: New LCM state is BOOT_FAILURE
can anyone please explain to me what's wrong here, Im familiar with vsphere esxi/vcenter, I want just to create a VMNetwork and attach it to the node physical NIC then attach the VM to this VMNetwork in order to give it LAN access, on VMware side it's easy simple but with OpenNebula Im not sure how it's work
Thank you
The problem here is that you are using a physical interface instead of using a bridge. If you would like to use bridge networking, you need to create a bridge or let OpenNebula create it for you.
Let me know if this answers your issue, if not, feel free to submit your query on OpenNebula Forum - https://forum.opennebula.io/. :)

New Sap Instance not working. No instance profiles found

I have installed sap server 7.51 on ubuntu virtual machine (vmware). Installation was sucessful but when I run start I get the following error:
ubuntu:npladm 1> startsap all
No instance profiles found
please send the tracefile /home/npladm/startsap.trc to support
I typed ifconfig and got the following:
ens33: flags=4163 mtu 1500
inet 192.168.234.130 netmask 255.255.255.0 broadcast 192.168.234.255
inet6 fe80::e152:4277:1c5f:3311 prefixlen 64 scopeid 0x20
ether 00:0c:29:9f:48:53 txqueuelen 1000 (Ethernet)
RX packets 1739 bytes 1139138 (1.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 1406 bytes 145716 (145.7 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73 mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10
loop txqueuelen 1000 (Local Loopback)
RX packets 5009 bytes 1102113 (1.1 MB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 5009 bytes 1102113 (1.1 MB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
I checked that the ip address in the host file is correct as in:
cat /etc/hosts
127.0.0.1 localhost
127.0.1.1 ubuntu
# mapping the Ubuntu loopback IP 127.0.1.1 to ubuntu
192.168.234.130 ubuntu ubuntu.dummy.nodomain
# The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters
127.0.0.1 localhost
127.0.1.1 ubuntu
# mapping the Ubuntu loopback IP 127.0.1.1 to vhcalnplci
127.0.1.1 vhcalnplci vhcalnplci.dummy.nodomain
As you can see the ip adress should be correct (192.168.234.130) and is pingable but it is still not working.
Update:
Here is also the trace log file:
Trace of system startup/check of SAP System NPL on Mon Jul 1 01:08:45 PDT 2019
{01:08:45 ## Main() start: #=/usr/sap/NPL/SYS/exe/uc/linuxx86_64/startsap all
#(#) $Id: //bas/749_STACK/src/krn/startscripts/startsap#1 $
BASENAME=startsap
{01:08:45 ## check_user() start: #=npladm
}01:08:45 ## check_user() done
#=1
#=all
{01:08:45 ## setPlatform() start
PLATFORM=linuxx86_64
}01:08:45 ## setPlatform() done
{01:08:45 ## setPing() start
PING=/bin/ping
}01:08:45 ## setPing() done
{01:08:45 ## setIfconfig() start
IFCONFIG=/sbin/ifconfig
}01:08:45 ## setIfconfig() done
{01:08:45 ## setIp() start
IP=/sbin/ip
}01:08:45 ## setIp() done
{01:08:45 ## setRootDir() start: #=
USR_SAP=/usr/sap
USR_SAP_SID=/usr/sap/NPL
PROFILE_DIR=/usr/sap/NPL/SYS/profile
DIR_LIBRARY=/usr/sap/NPL/SYS/exe/run
}01:08:45 ## setRootDir() done
{01:08:45 ## setDbUser() start: #=
}01:08:45 ## setDbUser() done
Argument=all
{01:08:45 ## getarg() start
{01:08:45 ## checkInstance() start: #=all
}01:08:45 ## checkInstance() done: 1
{01:08:45 ## checkTask() start: #=all
_opt=all
}01:08:45 ## checkTask() done: 0
TASK=ALL
}01:08:45 ## getarg() done: 1
{01:08:45 ## setVHostArray() start
_PROFILES=/usr/sap/NPL/SYS/profile/NPL_ASCS01_ubuntu /usr/sap/NPL/SYS/profile/NPL_D00_ubuntu
_nrProfiles=2
{01:08:45 ## pushVHostsFromProfile() start: #=/usr/sap/NPL/SYS/profile/NPL_ASCS01_ubuntu /usr/sap/NPL/SYS/profile/NPL_D00_ubuntu
_DUMMY=NPL_ASCS01_ubuntu
_VHOST=ubuntu
{01:08:45 ## isVHostLocal() start: ubuntu
VHOST=ubuntu
_IS_LOCAL=0
}01:08:46 ## isVHostLocal() done: 0
_DUMMY=NPL_D00_ubuntu
_VHOST=ubuntu
{01:08:46 ## isVHostLocal() start: ubuntu
VHOST=ubuntu
_IS_LOCAL=0
}01:08:46 ## isVHostLocal() done: 0
VHOSTS=
}01:08:46 ## pushVHostsFromProfile() done
VHOSTS=
}01:08:46 ## setVHostArray() done
{01:08:46 ## set_instance() start
NINST=
INSTFOUND=0
NINSTFOUND=0
hasABAP=0
hasJava=0
hasSpecial=0
}01:08:46 ## set_instance() done
No instance profiles found
Exit code 8
Any other ideas about the error and how to resolve it? Thanks.
updating the ip-address of my VM in /etc/hosts helped:
> sudo nano /etc/hosts
..
192.168.1.218 vhcalnplci vhcalnplci.dummy.nodomain
.. then i started server
> startsap ALL
.. and checked that instances are running
> sapcontrol -nr 00 -function GetProcessList

HyperV Gen2 VM not booting over PXE

I have two VMs in HyperV, both on the same virtual switch (internal), on the same subnet. I am trying to set up one as a DHCP and TFTP server for PXE boot. With Gen1 machine, it's working fine with pxelinux. Gen2 with UEFI does not unfortunately work.
DHCP & TFTP Server
IP 192.168.1.2
VLAN identification is disabled
DHCP - ISC DHCP Server running in a docker container with "host" network type with the following configuration:
set vendorclass = option vendor-class-identifier;
option pxe-system-type code 93 = unsigned integer 16;
set pxetype = option pxe-system-type;
authoritative;
default-lease-time 7200;
max-lease-time 7200;
option tftp-server-name "192.168.1.2";
option bootfile-name "efi/core.efi";
subnet 192.168.1.0 netmask 255.255.255.0 {
interface "eth0:0";
option routers 192.168.1.1;
option subnet-mask 255.255.255.0;
range 192.168.1.100 192.168.1.150;
option broadcast-address 192.168.1.255;
option domain-name-servers 8.8.8.8, 8.8.4.4;
option domain-name "ad.lholota.net";
option domain-search "ad.lholota.net";
if substring(vendorclass, 0, 9)="PXEClient" {
if pxetype=00:06 or pxetype=00:07 {
filename "efi/core.efi";
} else {
filename "pxelinux/pxelinux.0";
}
}
next-server 192.168.1.2;
}
TFTP - tftp-hpa running in a docker container on a "host" type network. I can download the efi files manually through a standard tftp client.
Booting machine
HyperV Gen2
No virtual HDD or DVD
Firmware tab has only one item in the boot sequence - network
Secure boot is disabled
VLAN identification is disabled
Network adapter pointing into the same internal switch as the first VM
Enable virtual machine queue - checked
Enable IPsec task offloading - checked, maximum number: 512
MAC Address dynamic
Enable DHCP guard - NOT checked
Enable router advertisement guard - NOT checked
Procted network - NOT checked
Mirroring mode - None
Enable device naming - NOT checked
The trouble is that the machine doesn't even get to the TFTP server because it doesn't finish the DHCP Discover-Offer-Request-Ack flow. It gets stuck on offer as shown in the dhcpdump below. The booting machine never sends the request message. Funny enough, BIOS based Gen1 HyperV machine boots without any issue so the DHCP flow works there.
Can you please give me a hint of what might be wrong?
TIME: 2018-07-11 19:49:37.641
IP: 0.0.0.0 (0:15:5d:0:50:d0) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
OP: 1 (BOOTPREQUEST)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: 8bf1c250
SECS: 0
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 0.0.0.0
SIADDR: 0.0.0.0
GIADDR: 0.0.0.0
CHADDR: 00:15:5d:00:50:d0:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: .
OPTION: 53 ( 1) DHCP message type 1 (DHCPDISCOVER)
OPTION: 57 ( 2) Maximum DHCP message size 1472
OPTION: 55 ( 35) Parameter Request List 1 (Subnet mask)
2 (Time offset)
3 (Routers)
4 (Time server)
5 (Name server)
6 (DNS server)
12 (Host name)
13 (Boot file size)
15 (Domainname)
17 (Root path)
18 (Extensions path)
22 (Maximum datagram reassembly size)
23 (Default IP TTL)
28 (Broadcast address)
40 (NIS domain)
41 (NIS servers)
42 (NTP servers)
43 (Vendor specific info)
50 (Request IP address)
51 (IP address leasetime)
54 (Server identifier)
58 (T1)
59 (T2)
60 (Vendor class identifier)
66 (TFTP server name)
67 (Bootfile name)
97 (UUID/GUID)
128 (???)
129 (???)
130 (???)
131 (???)
132 (???)
133 (???)
134 (???)
135 (???)
OPTION: 97 ( 17) UUID/GUID 008c0c7ab81331a0 ...z..1.
4297445b2e41610e B.D[.Aa.
a8 .
OPTION: 94 ( 3) Client NDI 010300 ...
OPTION: 93 ( 2) Client System 0007 ..
OPTION: 60 ( 32) Vendor class identifier PXEClient:Arch:00007:UNDI:003000
---------------------------------------------------------------------------
TIME: 2018-07-11 19:49:37.641
IP: 0.0.0.0 (0:15:5d:0:50:12) > 255.255.255.255 (ff:ff:ff:ff:ff:ff)
OP: 2 (BOOTPREPLY)
HTYPE: 1 (Ethernet)
HLEN: 6
HOPS: 0
XID: 8bf1c250
SECS: 0
FLAGS: 7f80
CIADDR: 0.0.0.0
YIADDR: 192.168.1.105
SIADDR: 192.168.1.2
GIADDR: 0.0.0.0
CHADDR: 00:15:5d:00:50:d0:00:00:00:00:00:00:00:00:00:00
SNAME: .
FNAME: efi/core.efi.
OPTION: 53 ( 1) DHCP message type 2 (DHCPOFFER)
OPTION: 51 ( 4) IP address leasetime 7200 (2h)
OPTION: 1 ( 4) Subnet mask 255.255.255.0
OPTION: 3 ( 4) Routers 192.168.1.1
OPTION: 6 ( 8) DNS server 8.8.8.8,8.8.4.4
OPTION: 15 ( 14) Domainname ad.lholota.net
OPTION: 28 ( 4) Broadcast address 192.168.1.255
I have had what i believe is the same issue when booting HyperV virtual machines on win10 2004(19041.685): gen 1 works, gen 2 times out without ever asking for the boot file.
I strongly suspect this is an issue with the GEN2 UEFI PXE implementation. Because as soon as I have at least two entries to choose from in the pxe boot menu it requests files and downloads as expected.
I run dnsmasq for tftp and DHCP and my config file below works if and only if at least one of the last two rows are uncommented. (pxe-service=x86-64_EFI and pxe-service=7 are equal)
config context: https://linuxconfig.org/how-to-configure-a-raspberry-pi-as-a-pxe-boot-server
# /etc/dnsmasq.d/03-tftpboot.conf
enable-tftp
tftp-lowercase
tftp-root=/mnt/data/netboot
pxe-prompt="Choose:"
pxe-service=x86PC,"PXELINUX (BIOS)",bios/pxelinux.0
pxe-service=x86PC,"WinPE (BIOS)",boot/pxeboot.n12
pxe-service=x86-64_EFI,"PXELINUX (EFI)",efi64/syslinux.efi
pxe-service=x86-64_EFI,"winpe (EFI)",boot/wdsmgfw.efi
#pxe-service=7,"PXELINUX (EFI-7)",efi64/syslinux.efi
I think I am experiencing the same problem when using digital rebar provisioner. Works great on Gen 1 but not on Gen 2. Have followed the same configuration as well.
Looking at the digital rebar code it seems like it should work but does not: https://github.com/digitalrebar/provision/blob/8269e1c7ff12a82854c19eccd114d064e2278211/midlayer/pxe.go#L252
I think this could be related:
https://wiki.fogproject.org/wiki/index.php/BIOS_and_UEFI_Co-Existence
https://serverfault.com/questions/739138/hyper-v-2016-gen2-vm-pxe-dhcp-timeout-wireshark-dhcp-discover-offer

convert pcregrep command in awk or sed

I have a multiline matching pcregrep command that I'd like to convert into an awk or sed command, because I need it on a machine where pcregrep is not available (OS X).
Original command:
ifconfig -a | pcregrep -M '^[a-z].*\n(\t[^\n]+\n)+\t[^\n]+baseTX' | grep -oE "^([a-z]+[^:]+)"
It output the name of the interface that contains the string “baseTX” (only method I found to reliably find out the name of the ethernet interface on a MacBook). In my case, “en4”.
The input text look like this:
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
options=3<RXCSUM,TXCSUM>
inet6 ::1 prefixlen 128
inet 127.0.0.1 netmask 0xff000000
inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1
nd6 options=1<PERFORMNUD>
gif0: flags=8010<POINTOPOINT,MULTICAST> mtu 1280
stf0: flags=0<> mtu 1280
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
ether xx:xx:xx:xx:xx:xx
inet6 xxxx::xxxx:xxxx:xxxx:xxx%en0 prefixlen 64 scopeid 0x4
inet 10.xxx.xxx.xx netmask 0xffffff00 broadcast 10.xxx.xxx.255
inet6 xxxx:xxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx prefixlen 128
nd6 options=1<PERFORMNUD>
media: autoselect
status: active
en5: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether xx:xx:xx:xx:xx:xx
media: autoselect <full-duplex>
status: inactive
en6: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
options=60<TSO4,TSO6>
ether xx:xx:xx:xx:xx:xx
media: autoselect <full-duplex>
status: inactive
en4: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=4<VLAN_MTU>
ether xx:xx:xx:xx:xx:xx
inet6 xxxx::xxxx:xxxx:xxxx:xxxx%en4 prefixlen 64 scopeid 0x7
inet XX.XXX.XXX.XX netmask 0xffffff00 broadcast XX.XXX.XXX.XXX
inet6 xxxx:xxx:xxxx:xxxx:xxxx:xxxx:xxxx:xxxx prefixlen 128
nd6 options=1<PERFORMNUD>
media: autoselect (100baseTX <full-duplex>)
status: active
bridge0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=63<RXCSUM,TXCSUM,TSO4,TSO6>
ether xx:xx:xx:xx:xx:xx
Configuration:
id 0:0:0:0:0:0 priority 0 hellotime 0 fwddelay 0
maxage 0 holdcnt 0 proto stp maxaddr 100 timeout 1200
root id 0:0:0:0:0:0 priority 0 ifcost 0 port 0
ipfilter disabled flags 0x2
member: en5 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 5 priority 0 path cost 0
member: en6 flags=3<LEARNING,DISCOVER>
ifmaxaddr 0 port 6 priority 0 path cost 0
nd6 options=1<PERFORMNUD>
media: <unknown type>
status: inactive
p2p0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 2304
ether xx:xx:xx:xx:xx:xx
media: autoselect
status: inactive
How can I grap “en4” with awk or sed? I tried for one hour, but I am just bad at sed and awk.
Assuming that spacing is consistent (leading spaces are only on non-header lines) this should work:
awk -F: '/^[[:alpha:]]/ {iface=$1; next} /baseTX/ {print iface; exit}'
perl:
perl -0777 -nE 'say map {/^\w+/ && $&} grep {/baseTX/} split /^(?=\w+:)/m'