CompTIA XK0-006 (CompTIA Linux+) Practice Test 34

Question 330

A firewall should allow packets based solely on addresses and port fields, without remembering previous connections. Which model describes it?

  1. Stateless packet filtering
  2. Destination NAT (DNAT)
  3. SNAT on egress
  4. DNAT with destination-port rewrite
  5. Source NAT (SNAT)

Explanation

Correct Answer

A:

Stateless filtering evaluates each packet against rules independently of flow history. Stateful policy uses connection-tracking context to recognize return traffic.

Incorrect Answers

B:

DNAT rewrites the destination address or port before forwarding to the intended private service; the task involves evaluating packets without connection history, whereas this addresses another subsystem.

C:

Egress SNAT changes the source information so replies can be routed back through the translating gateway; its scope differs from evaluating packets without connection history, so it cannot meet the stated requirement.

D:

Destination NAT can change both destination address and service port as packets enter the gateway; that is not equivalent to evaluating packets without connection history.

E:

SNAT rewrites packet source addresses for egress traffic and tracks return mappings; the administrator instead needs evaluating packets without connection history; this option serves a different purpose.

Question 331

Many private connections should share one public IP by using distinct translated source ports. Which technique enables this?

  1. net.ipv4.ip_forward=1
  2. SNAT on egress
  3. Port Address Translation (PAT)
  4. DNAT with destination-port rewrite

Explanation

Correct Answer

C:

PAT multiplexes connections through one public address by adjusting transport ports as needed. Stateful mappings let returning packets reach the right internal flow.

Incorrect Answers

A:

The kernel's IPv4 forwarding setting permits routing across interfaces when other policies allow it; it answers a neighboring question rather than sharing a public IP across concurrent outbound sessions.

B:

Egress SNAT changes the source information so replies can be routed back through the translating gateway; that changes a different part of the system; the requested outcome is sharing a public IP across concurrent outbound sessions.

D:

Destination NAT can change both destination address and service port as packets enter the gateway; it will not provide sharing a public IP across concurrent outbound sessions under these conditions.

Question 332

A Linux router must actually forward IPv4 packets between interfaces after firewall policy is set. Which sysctl controls that behavior?

  1. Port Address Translation (PAT)
  2. Destination NAT (DNAT)
  3. net.ipv4.ip_forward=1
  4. Stateless packet filtering

Explanation

Correct Answer

C:

The kernel's IPv4 forwarding setting permits routing across interfaces when other policies allow it. A permissive firewall by itself does not enable forwarding.

Incorrect Answers

A:

PAT multiplexes connections through one public address by adjusting transport ports as needed; the requirement is enabling kernel IPv4 packet forwarding, outside the effect of this choice.

B:

DNAT rewrites the destination address or port before forwarding to the intended private service; it does not deliver enabling kernel IPv4 packet forwarding, which is decisive in this scenario.

D:

Stateless filtering evaluates each packet against rules independently of flow history; the task involves enabling kernel IPv4 packet forwarding, whereas this addresses another subsystem.

Question 333

A packet-filter rule must match connection states and permit established return traffic. Which mechanism supplies state tracking?

  1. iptables -A INPUT ...
  2. ipset or nftables set
  3. ufw status numbered
  4. Conntrack state match

Explanation

Correct Answer

D:

Netfilter connection tracking recognizes flows such as established and related traffic. This allows return packets without explicitly opening every ephemeral port.

Incorrect Answers

A:

iptables manipulates the traditional chain/rule abstraction, possibly through an nft backend on modern distributions; that is not equivalent to distinguishing established traffic from new connections.

B:

Address sets allow a rule to test membership in many IP values efficiently; the administrator instead needs distinguishing established traffic from new connections; this option serves a different purpose.

C:

UFW can list configured rules with stable display numbers for the current listing; it answers a neighboring question rather than distinguishing established traffic from new connections.

Question 334

A public service uses TCP port 8443 externally but should reach an internal server on port 443. Which translation feature fits?

  1. Source NAT (SNAT)
  2. DNAT with destination-port rewrite
  3. Port Address Translation (PAT)
  4. net.ipv4.ip_forward=1

Explanation

Correct Answer

B:

Destination NAT can change both destination address and service port as packets enter the gateway. Return connections rely on matching stateful translation.

Incorrect Answers

A:

SNAT rewrites packet source addresses for egress traffic and tracks return mappings; it will not provide mapping an external port to a different internal port under these conditions.

C:

PAT multiplexes connections through one public address by adjusting transport ports as needed; the requirement is mapping an external port to a different internal port, outside the effect of this choice.

D:

The kernel's IPv4 forwarding setting permits routing across interfaces when other policies allow it; it does not deliver mapping an external port to a different internal port, which is decisive in this scenario.

Question 335

A firewalld change must allow the ssh service persistently AND be activated in the current running firewall. Which TWO commands complete both steps? Choose TWO.

  1. firewall-cmd --permanent --add-service=ssh
  2. Firewalld rich rule with source address
  3. firewall-cmd --reload
  4. firewall-cmd --zone=public --list-all
  5. firewall-cmd --get-active-zones

Explanation

Correct Answers

A:

The permanent flag changes saved zone configuration rather than only the current runtime. A reload or corresponding runtime change is needed to activate it immediately.

C:

firewall-cmd --reload makes firewalld apply saved permanent rules to the active runtime policy. In this question the SSH allowance must first be saved persistently, or a reload would not keep the intended change.

Incorrect Answers

B:

Rich rules combine conditions such as source address and service with actions; its scope differs from persistently saving and activating an SSH firewall allowance, so it cannot meet the stated requirement.

D:

The list-all view reports the chosen zone's ports, services, interfaces and sources; the administrator instead needs persistently saving and activating an SSH firewall allowance; this option serves a different purpose.

E:

This command reports active zone names and attached sources or interfaces; it answers a neighboring question rather than persistently saving and activating an SSH firewall allowance.

Question 336

An administrator has a long list of source IPs to block and wants efficient set-based matching. Which feature fits?

  1. ufw status numbered
  2. nftables
  3. Conntrack state match
  4. ufw allow 443/tcp
  5. ipset or nftables set

Explanation

Correct Answer

E:

Address sets allow a rule to test membership in many IP values efficiently. They avoid duplicating an entire rule for every address.

Incorrect Answers

A:

UFW can list configured rules with stable display numbers for the current listing; that changes a different part of the system; the requested outcome is matching a firewall rule against an IP address set.

B:

nftables is a modern Netfilter ruleset framework supporting tables, chains, sets and state matching; this does not achieve matching a firewall rule against an IP address set on the system described.

C:

Netfilter connection tracking recognizes flows such as established and related traffic; it will not provide matching a firewall rule against an IP address set under these conditions.

D:

UFW provides a simplified frontend to host firewall rules; using it would leave matching a firewall rule against an IP address set unresolved.

Question 337

Network operators need to inspect all effective port and service permissions in one selected zone. Which command displays them?

  1. firewall-cmd --zone=public --list-all
  2. Firewalld zones
  3. firewall-cmd --reload
  4. firewall-cmd --permanent --add-service=ssh

Explanation

Correct Answer

A:

The list-all view reports the chosen zone's ports, services, interfaces and sources. It helps identify where a rule was actually applied.

Incorrect Answers

B:

Zones associate interfaces or sources with collections of allowed services and ports; the evidence calls for listing a zone's runtime rules and associations, not merely this separate operation.

C:

Reloading reapplies permanent firewalld configuration to the active ruleset; the task involves listing a zone's runtime rules and associations, whereas this addresses another subsystem.

D:

The permanent flag changes saved zone configuration rather than only the current runtime; its scope differs from listing a zone's runtime rules and associations, so it cannot meet the stated requirement.

Question 338

Administrators want to determine the currently active zones and their associated interfaces. Which command displays them?

  1. firewall-cmd --get-active-zones
  2. firewall-cmd --zone=public --list-all
  3. Firewalld rich rule with source address
  4. firewall-cmd --reload
  5. firewall-cmd --add-service=https
  6. Firewalld zones

Explanation

Correct Answer

A:

This command reports active zone names and attached sources or interfaces. It is diagnostic and does not modify the firewall.

Incorrect Answers

B:

The list-all view reports the chosen zone's ports, services, interfaces and sources; it answers a neighboring question rather than inspecting active firewalld zone assignments.

C:

Rich rules combine conditions such as source address and service with actions; that changes a different part of the system; the requested outcome is inspecting active firewalld zone assignments.

D:

Reloading reapplies permanent firewalld configuration to the active ruleset; this does not achieve inspecting active firewalld zone assignments on the system described.

E:

Adding a service uses firewalld's defined port/protocol mapping for that service; it will not provide inspecting active firewalld zone assignments under these conditions.

F:

Zones associate interfaces or sources with collections of allowed services and ports; using it would leave inspecting active firewalld zone assignments unresolved.

Question 339

A rule should allow SSH only from one management subnet rather than every source. Which firewalld feature supports a source-conditional rule?

  1. Firewalld rich rule with source address
  2. firewall-cmd --add-service=https
  3. firewall-cmd --reload
  4. firewall-cmd --add-port=8443/tcp

Explanation

Correct Answer

A:

Rich rules combine conditions such as source address and service with actions. They provide finer control than simply opening a zone-wide service.

Incorrect Answers

B:

Adding a service uses firewalld's defined port/protocol mapping for that service; the requirement is restricting an allowed service to a source subnet, outside the effect of this choice.

C:

Reloading reapplies permanent firewalld configuration to the active ruleset; it does not deliver restricting an allowed service to a source subnet, which is decisive in this scenario.

D:

A runtime command modifies active rules without changing permanent configuration; the evidence calls for restricting an allowed service to a source subnet, not merely this separate operation.

Question 340

A Linux gateway runs a local transparent HTTP proxy on port 3128. Incoming TCP requests addressed to port 80 should be intercepted by that gateway itself, without a separate destination server address. Which nftables NAT statement fits?

  1. redirect to :3128
  2. masquerade
  3. snat to 198.51.100.10
  4. ct state established
  5. drop

Explanation

Correct Answer

A:

The nftables redirect statement changes the destination to a local socket on the gateway. In an appropriate NAT chain matching TCP port 80, it can deliver traffic to the local proxy on port 3128.

Incorrect Answers

B:

Masquerading changes the source address for outbound NAT traffic. It does not move inbound HTTP traffic to a different local listener port.

C:

Static source NAT changes where a packet appears to originate. It leaves the requested local destination-port interception unimplemented.

D:

Connection-state matching classifies an existing flow but does not perform destination translation. It cannot redirect new inbound requests to the local proxy.

E:

A drop verdict silently discards matching packets. The request is to deliver HTTP requests to the proxy, not block them.

CompTIA Linux+ (XK0-006) Practice Tests